Rename and move with one command.

Started by Jom, July 09, 2019, 12:47:54 PM

Previous topic - Next topic

Jom

Hello.
I can not figure out how to rename and move RAW files with different extensions from one folder to folders by year and day.

I have:

testfolder/
      file1.cr2
      file2.arw

I need:

2018/
      2018_12_23/
            20181223_165415.cr2
2019/
      2019_02_03/
            20190203_122532.arw

StarGeek

Try this test command, alter the path as needed
exiftool -d "%Y_%m_%d/%Y%m%d_%H%M%S.%%e" "-Testname</path/to/targetfolder/$DateTimeOriginal"  testfolder/

If the results from that look right, then change Testname to Filename.  You don't mention your OS, so if you're on Mac/Linux, swap double quotes for single quotes.

Also, if there is a possibility of two pictures with the same time stamp, you might add -%%c to the date format after the %S so as to add an incremental number.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Jom

Спасибо, буду пробовать.

Jom

For me this option:

exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S.%%e" "-FileName<D:\_\test\$DateTimeOriginal" .

But how to adding File Number to end to file name?
I have "File number : 101-245" tag in my .cr2.
I need:

20180225_1546_101-245.cr2

Hayo Baan

Advanced formatting should allow for this, try:
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S.%%e" "-FileName<${DateTimeOriginal;$_=qq(D:\\_\\test\\$_$$self{FileNumber})}" .
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

Or just move the extension out of the date string

exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" .
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Jom

Quote from: Hayo Baan on July 10, 2019, 10:54:42 AM
Advanced formatting should allow for this, try:
exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S.%%e" "-FileName<${DateTimeOriginal;$_=qq(D:\\_\\test\\$_$$self{FileNumber})}" .
I'm trying it, but it doesn't work.

Jom

Quote from: StarGeek on July 10, 2019, 11:23:57 AM
Or just move the extension out of the date string

exiftool -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" "-FileName<D:\_\test\${DateTimeOriginal}_$FileNumber.%e" .

It works.

StarGeek

Quote from: andreikorzhyts on July 10, 2019, 12:16:11 PM
I'm trying it, but it doesn't work.

Strange.  I copy/pasted the command and it worked here.  Glad the other version works for you, but I'm still curious about the error.  What version of exiftool are you using?
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Jom

#9
Спасибо за помощь.

I'm attached screenshot. Hope this helps.

StarGeek

Strange.  The command appears to be correct.  But I can't replicate the error here.

Anyway, glad we got a working version for you.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Jom

Спасибо, буду использовать этот вариант.