Sort files in bulk with PowerShell

I want to find more time to learn PowerShell from the ground up. So far I’ve been scripting with it and learning chunks and cmdlets at a time as I need them. For example:

When I take pictures with my awesome Lumia HD phone, it takes two photos simultaneously: a gorgeous 20-megapixel photo and a far smaller 5mp compressed jpeg version used when sharing from your phone.

Connecting the camera to your computer and pulling in the photos, you’ll see both copies. I built a little PowerShell loop that will check for files with the low-res name and move any elsewhere. I did this instead of deleting it, but it could easily be adapted to remove the files instead. I made this a while ago, hadn’t shared it because, well, do you have a Lumia HD camera? Does anyone you know?

cd"C:\users\shawn\onedrive\pictures"#make an arrive of files under the current folder, restricted to files with particular names and the file isn't a container (a folder)$files=Get-ChildItem.*_Pro__highres.jpg-rec|where-object{!($_.psiscontainer)}#loop actions on every file (this could be piped)ForEach($filein$files){#set variable to name that low-res copy would be$lowres=($file.fullname-replace"__highres","")if(test-path$lowres){#test if a file by the expected name exists and move it if somove-item-path$lowres-destinationc:\sorter}else{#no file name exists with the low-res name}}

I also used this same type of script to loop through and remove nearly an entire gigabyte of thumbs.db and desktop.ini files, mostly created on Windows XP machines years ago, from a file share that was getting migrated to new servers. Let me tell you this thing was massive. Many millions of files across more than 500,000 folders, some deeper than NTFS even allows.

Bonus chatter, what’s a desktop.ini file?

Writing a PowerShell script to erase these took nearly as much time as it did to explain what they are.