I have a folder of images taken on two different mobile phones. The two phones use slightly different file name formats. I want to change one of them to match the other so I have a neat photo album.
How can I change a file name from 20110809_121158.jpg
to 2011-08-09 12.11.58.jpg
?
It will be great if the solution comes by using Powershell but any other option is also welcome!
Best Answer
Here's one way to do it, using SubString:
To use this to rename a selection of file entries in a folder, you can use something like this:
As written, this script won't actually change anything - it lets you preview what would change by outputting the proposed rename command to the console. To actually rename the files you'd have to remove the "Write-Host" statements. This script assumes that all you have in the folder are the two types of file names you mentioned.
Selects only files containing an underscore so we don't try to rename the other type of file. This script is meant to run in the subject folder; running it elsewhere might do strange things to the wrong files.