How To Renaming Pictures with PowerShell

Renaming a single file is easy using Rename-Item, but sometimes this cmdlet parameter can be much smarter and help you automate in bulk copy or move. For example, my lock screen picture in Windows 10 shows often beautiful pictures which I want to save. These pictures are hard to find, but when you know where they are it’s also a difficult task to find out which picture it was. After investigation I know the most pictures which I like are greater then 300 Kb.

The location of the Windows 10 lock screen pictures is:

C:\Users\$env:UserName\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets

I put this location in a variable $Path and I want all files greater then 300Kb, so I put this value in the variable $FileSize to make things easier. Now we have this information I write the following PowerShell script:

When you run the script above, you will get something similar like:

All files greater then 300Kb are copied to C:\Temp. These are long file names and have no file extension, but I know these files are in .jpg format.

With the following script I renamed all files and let them begin with a number and give them the extension .jpg:

Opening again the File Explorer and go to C:\Temp, you will see something similar like this:

Easy or not 😉

In this article I’ll show you how easy it is to bulk copy or moving files with specific criteria. I also show you where you can find the Windows 10 lock screen pictures. With a simple script I’ll show you also how to bulk rename the pictures.

I really like to hear what you have to say about this article:

  • Was this article helpful for you or do you have any questions?
  • Do you have additions, suggestions or any other ideas?
  • Just let me know by leaving a comment below.

Thank you for spending some time at my site and in my blog. I hope you come to visit again soon!

About Lex van der Horst 201 Articles
Techwire

Be the first to comment

Leave a Reply