Rename and sort into Subfolders

Started by Leerzeichen, May 19, 2020, 05:33:57 PM

Previous topic - Next topic

Leerzeichen

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

StarGeek

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.  And you can add directories to the -d (dateFormat) option.
* 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).

Leerzeichen

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...


Leerzeichen

Can exiftool add the month as a name?
(attached picture)

StarGeek

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.
* 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).

Leerzeichen

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  :)

StarGeek

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).  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#"
* 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).

Leerzeichen

#7
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.

Phil Harvey

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
...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 ($).

Leerzeichen

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

Phil Harvey

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
...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 ($).