gci | Sort-Object creationTime | foreach-object -Process{$num++;$numStr=$num.ToString("0000"); rename-item $_ "$numStr$_"}
Tuesday, November 15, 2011
Assign base numbers to large set of files using powershell
I had a task of assigning base numbers to a large set of files (5000+ in my case). My case was to sort the files based on creation time and add numbers. I had to format numbers to have same length. Thanks to powershell I could do it in no time. Here is the script
Subscribe to:
Posts (Atom)