Rename and keep original file

Started by OOmatrixOO, March 06, 2016, 04:54:49 AM

Previous topic - Next topic

OOmatrixOO

Hello.
How can i make this in a easy way:

1. Rename "xxx.jpg" to "new_createdate.jpg" but keep the original file in the original folder
2. move "new_createdate.jpg" to a new folder

Thank you for your help.

Phil Harvey

like this:

exiftool -o NEWFOLDER/ "-filename<NEW_$createdate.%e" -d "SOME_DATE_FORMATTING" xxx.jpg

here, xxx.jpg may be a folder name to act on all images in that folder.  See the FileName page for more details and help with date formatting codes.

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

OOmatrixOO

Thank you.
This is what i use now:

exiftool -o NEWFOLDER/ "-filename<NEW_$createdate.%e" -d %Y%m%d *.jpg

But i have this error:
Warning: [minor] Tag 'createdate' not defined -
Error: No file specified -
    0 image files updated
    1 files weren't updated due to errors


Phil Harvey

If CreateDate doesn't exist in the file then you need to find some other date/time tag that does.  Use this command to see them:

exiftool -time:all -s 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 ($).

OOmatrixOO

Is there no CreateDate or can i use an other tag?

FileModifyDate                  : 2015:03:24 16:58:49+01:00
FileAccessDate                  : 2016:03:06 17:16:59+01:00
FileCreateDate                  : 2016:03:06 17:16:59+01:00
ModifyDate                      : 2015:03:24 16:58:46
DateTimeOriginal                : 2015:02:22 11:20:35
CreateDate                      : 2015:02:22 11:20:35
SubSecTimeOriginal              : 80
SubSecTimeDigitized             : 80
DateCreated                     : 2015:02:22
TimeCreated                     : 11:20:35
DigitalCreationDate             : 2015:02:22
DigitalCreationTime             : 11:20:35
ModifyDate                      : 2015:03:24 16:58:46+01:00
CreateDate                      : 2015:03:24 16:58:46+01:00
MetadataDate                    : 2015:03:24 16:58:46+01:00
DateCreated                     : 2015:02:22
HistoryWhen                     : 2015:03:01 16:02:32+01:00
DateTimeOriginal                : 2015:02:22 11:20:35+01:00
DateTimeDigitized               : 2015:02:22 11:20:35+01:00
ProfileDateTime                 : 1998:02:09 06:49:00
DateTimeCreated                 : 2015:02:22 11:20:35
DigitalCreationDateTime         : 2015:02:22 11:20:35
SubSecCreateDate                : 2015:02:22 11:20:35.80
SubSecDateTimeOriginal          : 2015:02:22 11:20:35.80

Phil Harvey

This should work then, as long as you use the same file in the other command.

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

OOmatrixOO

#6
Ok it works now. thanks.
How can i put a counter in the filename? Like this: file1_001, file2_002 and so on?

exiftool -o Bearbeitet/ "-filename<NEW_(COUNTER 001)_$createdate.%e" -d %d.%m.%Y *.jpg

Phil Harvey

All percent characters need to be doubled in .bat files
...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 ($).

OOmatrixOO

Quote from: Phil Harvey on March 06, 2016, 01:32:32 PM
All percent characters need to be doubled in .bat files

Yes i found this problem and it work now :-) thank you. Can you help me on more with the Counter?
How can i put a counter in the filename? Like this: file1_001, file2_002 and so on?

exiftool -o Bearbeitet/ "-filename<NEW_(COUNTER 001)_$createdate.%e" -d %d.%m.%Y *.jpg

Phil Harvey

Look at the %C feature in the -w option section of the application documentation.  I think you probably want %1.3C

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

OOmatrixOO

Wow thats great.

This is my batch file:
@echo off
:eingabe
set /p Bildname=Namen eingeben:

:: initialise some variables that can be practical...
set BatFileDir=%~dp0

:: Start to do the real work
echo Busy processing file %1
"%BatFileDir%\"exiftool -o Bearbeitet/%Bildname%/ "-filename<%Bildname% $createdate (%%1.3C).%%e" -d %%d.%%m.%%Y *.jpg "-Caption-Abstract<%Bildname% $createdate (%%1.3C).%%e -d %%d.%%m.%%Y *.jpg"
echo.

:: If an error occured, pause...
if %errorlevel% neq 0 pause

pause












The only problem is that "-Caption-Abstract<%Bildname% $createdate (%%1.3C).%%e -d %%d.%%m.%%Y *.jpg" not work. It write London 22.02.2015 (%1.3C).%e -d %d.%m.%Y *.jpg but London 22.02.2015 (001) is right.

Ive also tried "-Caption-Abstract<BaseName" or "-Caption-Abstract<filename" but this wrote the original filename DSC_2641

Phil Harvey

The %e and %C are only meaningful when written to a file name.

To store the FileName in Caption-Abstract, do this in a separate command after setting FileName:

exiftool "-caption-abstract<filename" DIR

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