Converting to lowercase

Started by Fulco, February 25, 2016, 11:02:24 AM

Previous topic - Next topic

Fulco

I rename files with an uppercase file extensions, but how can I convert the extensions in a lowercase?

I tried this, but the result is a "double" file extension:

exiftool -d %Y%m%d%H%M%S%%-c '-FileName<${DateTimeOriginal}-$FileName.%le'

- Fulco

Phil Harvey

Hi Fulco,

You'll get what you want if you use %f instead of $FileName in your string.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Fulco

Thank you Phil! In the command below it works only partially. Only files which are renamed into a filename with a CreateDate prefix will have a lowercase file extension. The files which have VIDEO|IMG|P1 in their filename are still renamed with an uppercase. Is it possible to rename all files with a lowercase?

exiftool '-FileName<${CreateDate}${FileName;$_=/(VIDEO|IMG|P1)/i ? "-$_" : ".%le"}' -api QuickTimeUTC -d %Y%m%d%H%M%S%%-c

- Fulco

StarGeek

If you're on Windows, this might be yet another Windows quirk.   Since Windows file system doesn't differentiate between upper and lowercase, it doesn't think the filename has changed when only the case is changed.

Last time I tried something like this with Exiftool, my workaround was to add an additional extension to all the files getting renamed, then removing that extension with a second command.  My batch file was something like this:
Exiftool"-filename<${filename;blah blah blah}.MyTemp" %*
Exiftool -ext .MyTemp "-filename<${filename;s/\.MyTemp$//i}" %*


Edit:  I just came across this reg edit which says it will allow you to make case changes without windows interference. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Fulco

Thanks for your reply. I'm on a Mac. I add XMP metadata to re-encoded files with a csv file. The source file filenames in the file paths listed in the csv file are based on the video files which are not re-encoded (original files). The re-encoded files have a lowercase. The original files must have a lowercase too because adding XMP metadata is case sensitive. The example below doesn't work.

csv file:
SourceFile,Make,Model,Software,Subject,GPSLatitude,GPSLatitudeRef,GPSLongitude,GPSLongitudeRef
/Users/Fulco/Pictures/20150723145321-DSCN3456.MOV,NIKON CORPORATION,NIKON D600,EditReady,"France, Paris, Place de la Bastille",48.853173,North,2.369137,East

Target file:
20150723145321-DSCN3456.mov

If converting to a lowercase with Exiftool is not possible I will use "A Better Finder Rename 10" to do this, but my goal is to keep the number of steps in my workflow as low as possible.

- Fulco

Fulco

#5
I solved this. I made with Automator a folder action which automatically converts an uppercase into a lowercase file extension from video files.

- Fulco