ExifTool Forum

ExifTool => Newbies => Topic started by: jpotrz on February 07, 2019, 02:36:57 PM

Title: Adding camera make and model to file/folder name?
Post by: jpotrz on February 07, 2019, 02:36:57 PM
I'm just learning about EXIFtool (loving it!) and for that matter writting *nix scripts (hating it!) and while I have done a fair amount of googling to try to find the answer, I've run into a question on how to get the make and/or model of the camera into the file name.

I have a fairly simple script as show below:

#exiftool -progress "-FileName<FileModifyDate" "-FileName<DateCreated" "-FileName<CreateDate" -d "mnt/user/Media/Photos/%%le/%Y/%m/%Y-%m-%d [%H.%M.%S%p].%%le" -r -v "/mnt/user/Media/!!!Pending/Pending Photos"


How would I go about inserting the camera make/model into it so that the diretory structure is /%le/<camera make> <camera model>/%Y/%m/%Y-%m-%d [%H.%M.%S%p].%%le
Thank you in advance.
Title: Re: Adding camera make and model to file/folder name?
Post by: StarGeek on February 07, 2019, 02:51:11 PM
Good start learning about using multiple dates as fallback.  The difference now is that in using multiple tags in the name, you need to add the dollar sign to treat them as strings.

See this previous post (https://exiftool.org/forum/index.php/topic,5269.msg25509.html#msg25509) for an example.  Unfortunately, you would have to add the Make and Model to each of item.  Also, as per the example, you'll have to move the extension variable out of the date string and use only one percent sign instead of two. 

Also, you'll need to switch the double quotes to single quotes to prevent bash from interpreting the exiftool variables as bash variables.

Finally, depending upon your camera, you might need to enclose the Make and Model name in braces and add a trailing semicolon inside the braces.  That would be to avoid using illegal filename characters or creating unwanted subdirectories.

As an example:
'-FileName<${FileModifyDate}_${Make;}_${Model;}.%le'
Title: Re: Adding camera make and model to file/folder name?
Post by: jpotrz on February 07, 2019, 03:12:12 PM
Quote from: StarGeek on February 07, 2019, 02:51:11 PM
Good start learning about using multiple dates as fallback.  The difference now is that in using multiple tags in the name, you need to add the dollar sign to treat them as strings.

See this previous post (https://exiftool.org/forum/index.php/topic,5269.msg25509.html#msg25509) for an example.  Unfortunately, you would have to add the Make and Model to each of item.  Also, as per the example, you'll have to move the extension variable out of the date string and use only one percent sign instead of two. 

Also, you'll need to switch the double quotes to single quotes to prevent bash from interpreting the exiftool variables as bash variables.

Finally, depending upon your camera, you might need to enclose the Make and Model name in braces and add a trailing semicolon inside the braces.  That would be to avoid using illegal filename characters or creating unwanted subdirectories.

As an example:
'-FileName<${FileModifyDate}_${Make;}_${Model;}.%le'

Thanks for the (more than) quick response! A lot to soak in there and wrap my head around.
In regards to the double versus single quotes. I swear in all my trial and error whenever I used single quotes nothing worked. Maybe I was doing something wrong though?
Title: Re: Adding camera make and model to file/folder name?
Post by: StarGeek on February 07, 2019, 04:25:57 PM
I just assumed some sort of linux type command line since I saw the leading hashmark in your command.  All I can suggest is trial and error to see what works for you.

I deal with my own sorta hell using Windows. :D