I have 14,000 images sorted by file by year and month, but taken with multiple cameras, and I want the file name to reflect the date of the shooting. For example, on October 16, 1998, the images are in a folder named 1998 \ October 10 \ 19981016 .
I want all the photos to be named 19981016_0001 19981016_0002 etc. I tried a few suggestions, but that didn't work.
I can get to the point where the folders that I want to change are listed, but I cannot change them. All my photos are .jpg.
Attempts to create a temporary copy file in case I messed it up. I started by typing cd "C:\Documents and Settings\Brooke LastName\Desktop\Temp" then, having successfully downloaded my file, I used the formula found in this forum.
ls *jpg | Foreach {$i=1} {Rename-Item _ -NewName ("$($.19981016){0:00000000#} .jpg" -f $i++) -whatif}
The error I received said
Unexpected token ' .19981016' in expression or statement. At line:1 char:12 + $.19981016 <<<<
The error was repeated several times.
I found several formulas on the Internet, but most of the created files that are numbered in brackets, for example, leave (1) .jpg . I want a four-digit counter after the underscore at the end of my date, e.g. 19981016_0001
powershell
Brooke
source share