Rename multiple files as "Modified Date/Time" using cmd or Powershell

Posted by Mehper C. Palavuzlar on Super User See other posts from Super User or by Mehper C. Palavuzlar
Published on 2011-01-14T12:45:07Z Indexed on 2011/01/14 12:55 UTC
Read the original article Hit count: 264

I have hundreds of JPG files in a folder. I want to rename each file so that the file name is replaced with "Modified Date/Time" of that file, namely DD.MM.RRRR.HH.MM.jpg. For example,

Before    After  

001.jpg   11.01.2011.16.58.jpg  
002.jpg   12.01.2011.09.32.jpg  
003.jpg   14.01.2011.12.41.jpg  
...       ...

Since colon (:) cannot be used in file names, the colon between HH and MM must be replaced with a period.

I don't want to use a 3rd party tool. Can you provide me with the code to achieve this in Powershell or command line?

© Super User or respective owner

Related posts about windows-7

Related posts about command-line