ExifTool Forum

ExifTool => Newbies => Topic started by: Leerzeichen on May 19, 2020, 05:33:57 PM

Title: Rename and sort into Subfolders
Post by: Leerzeichen on May 19, 2020, 05:33:57 PM
Hi together

I have thousends of jpg Files from Different File based backups from different cameras, they are all unsorted.

I would like to start with rename and sort the IMGxxx.jpg to picturetakendate, also set "file modified" and "file created" to picturetakendate

I found and copied this commands
exiftool -r. -d "%Y%m%d_%H%M%S.%%e" -ext jpg "-Filename<CreateDate" "-filemodifydate<createdate" "-filecreatedate<createdate" "E:\test"
I tested it with some files and it is working great!

But now i want Rename and sort this Files into "YYYY\MM" Folder
I tried some code from the forum, read the FAQ, but it was not working.

Should be simple, i know, but i have no idea

I'm using Windows 10 1909, German Language

thank you very much in advance
Title: Re: Rename and sort into Subfolders
Post by: StarGeek on May 19, 2020, 05:46:52 PM
Change
-d "%Y%m%d_%H%M%S.%%e"
into
-d "%Y/%m/%Y%m%d_%H%M%S.%%e"

You can find the codes that represent parts of the date here (https://exiftool.org/filename.html#codes).  And you can add directories to the -d (dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat).
Title: Re: Rename and sort into Subfolders
Post by: Leerzeichen on May 19, 2020, 06:11:36 PM
wow, quite fast answer - thank you StarGeek
It is working fine, but it seams, if i have pictures with identical "picturetakendate", exiftool can do the first file, but not the second.

i changed
-d "%Y/%m/%Y%m%d_%H%M%S.%%e"
into
-d "%Y/%m/%Y%m%d_%H%M%S%%-c.%%e"
worked!

I can't follow your tipp with
Quoteyou can add directories to the -d (dateFormat) option.
I read the instruction but i don't understand it...

Title: Re: Rename and sort into Subfolders
Post by: Leerzeichen on May 19, 2020, 06:25:45 PM
Can exiftool add the month as a name?
(attached picture)
Title: Re: Rename and sort into Subfolders
Post by: StarGeek on May 19, 2020, 08:00:54 PM
Follow the first link I gave.  It will give you all the %codes that you can use for date/time values.  Full local month name is %B.
Title: Re: Rename and sort into Subfolders
Post by: Leerzeichen on May 24, 2020, 03:09:13 PM
Thank you, it is working!

The Files form my Samsung has already the correct filename yyyymmdd_hhmmss.jpg.
How can i easy change only the filecreatedateand filemodifydate?

I tried this, it is working, but i think it is not correct
exiftool -r. -ext jpg "-Filename<CreateDate" "-filemodifydate<createdate" "-filecreatedate<createdate" "y:"

It is also possible to change this in subdirectories, without moving the files?

thank you again  :)
Title: Re: Rename and sort into Subfolders
Post by: StarGeek on May 24, 2020, 03:20:16 PM
Is that the command you used?  It looks incomplete.  If you're running it on the current directory and subdirectories, you need a space between the -r and the dot ..  Is there supposed to be a -d option there?

But if you want to rename and change the file system time stamps at the same time, you need to add a hashtag to the end of CreateDate for those tags (see the -n (printConv) option (https://exiftool.org/exiftool_pod.html/exiftool_pod.html#n---printConv)).  This is because the -d option affects the CreateDate when you are trying to copy to the file system times and those must be in the YYYY MM DD HH mm ss order.

So when you're using the -d option, use this
"-filemodifydate<createdate#" "-filecreatedate<createdate#"
Title: Re: Rename and sort into Subfolders
Post by: Leerzeichen on May 24, 2020, 03:50:22 PM
yes i run it like this, but i think the command try to rename the files to nothing, because empty filenames are not allowed, he change only the Dates.
Title: Re: Rename and sort into Subfolders
Post by: Phil Harvey on May 25, 2020, 09:17:28 AM
If you don't use the -d option to specify the date/time formatting, then this command will try to rename the files to something like

"2020:05:25 09:15:56"

...which

1. won't work because the names contain a ":"

2. would remove the file extensions

Try adding this to the command: -d %Y-%m-%d_%H%M%S.%%e

- Phil
Title: Re: Rename and sort into Subfolders
Post by: Leerzeichen on May 25, 2020, 05:14:02 PM
Hi Phil

thank you for your reply.

This corresponds to the original command. The file name is already correct, I just want to set the modification date and the creation date identical to the recording date.

Is there a simple code for this too?

regards
Title: Re: Rename and sort into Subfolders
Post by: Phil Harvey on May 25, 2020, 09:25:36 PM
First you need to figure out what tags you want to write.  use this command:

exiftool -time:all -s -G1 FILE

then set the tags you want with a command like this:

exiftool "-TAG1<SRCTAG" "-TAG2<SRCTAG" ... FILE

- Phil