Hello,[snip]
I use a script to rename image files copied from a camera to include the
EXIF generated date into each filename.
I use a script to rename image files copied from a camera to include the >EXIF generated date into each filename.
The filenames originally appear as follows::
DSC00071.JPG
DSC00075.JPG
DSC00086.JPG
DSC00093.JPG
DSC00116.JPG
DSC00133.JPG
After running the script, they appear as:
20190531_083305_DSC00071.jpg
20190531_083429_DSC00075.jpg
20190531_092253_DSC00086.jpg
20190531_092643_DSC00093.jpg
20190531_093211_DSC00116.jpg
20190531_095200_DSC00133.jpg
Nothing wrong with the procedure, it works great, but sometimes I run it >twice on a batch of files by mistake, ending up with the following:
20190531_083305_20190531_083305_DSC00071.jpg >20190531_083429_20190531_083429_DSC00075.jpg >20190531_092253_20190531_092253_DSC00086.jpg >20190531_092643_20190531_092643_DSC00093.jpg >20190531_093211_20190531_093211_DSC00116.jpg >20190531_095200_20190531_095200_DSC00133.jpg
(... plus thousands more.)
Whenever it happens I erroneously prepend the date string and underscores to >previously processed files, i.e. the 16 characters of each filename as >above.
How can I remove the 16 characters in each filename, by renaming all files >in the current working directory to retain only the last 28 last characters?
But so I don't rename filenames that may still exist in the same directory >which are still correctly named, the procedure should apply only on files >which are exactly 44 characters long as the wrongly named files in this >example are.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 89:55:00 |
Calls: | 6,658 |
Files: | 12,203 |
Messages: | 5,334,088 |