ExifTool Forum

ExifTool => Newbies => Topic started by: Fulco on February 25, 2016, 11:02:24 AM

Title: Converting to lowercase
Post by: Fulco on February 25, 2016, 11:02:24 AM
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
Title: Re: Converting to lowercase
Post by: Phil Harvey on February 25, 2016, 11:34:29 AM
Hi Fulco,

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

- Phil
Title: Re: Converting to lowercase
Post by: Fulco on February 25, 2016, 12:39:09 PM
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
Title: Re: Converting to lowercase
Post by: StarGeek on February 25, 2016, 01:27:53 PM
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 (http://www.techsupportalert.com/content/how-force-your-windows-file-and-folder-names-have-case-you-want.htm) which says it will allow you to make case changes without windows interference. 
Title: Re: Converting to lowercase
Post by: Fulco on February 25, 2016, 02:53:56 PM
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
Title: Re: Converting to lowercase
Post by: Fulco on February 25, 2016, 05:04:30 PM
I solved this. I made with Automator a folder action which automatically converts an uppercase into a lowercase file extension from video files.

- Fulco