Search This Blog

Showing posts with label rename files. Show all posts
Showing posts with label rename files. Show all posts

Friday, November 22, 2013

Powershell to rename a group of files by adding the Created Date to the name.

If you have a need to add the date to a file name to help identify when it was created this script may have a use to to you.

It will search through a folder and rename a file by appending the date created to the original name of the file.

Get-ChildItem -Filter "*.csv" -Recurse | Rename-Item -NewName {$_.BaseName + $_.CreationTime.toString("ddMMMyy") + ".csv" }

Note:
The above script will only look for files in the path that you are currently in in powershell. 

Example of the output

original filename was something.csv

new filename  becomes something22Nov13.csv