Hy,
Sorry for my poor english.
I try to make a batch file to rename my photos and videos on windows.
If i put the line in a shell windows it works.
d:\>exiftool f:\test "-FileName<CreateDate" -d "%Y%m%d-%H%M%S.%e"
1 directories scanned
4 image files updated
If I put a variable for the directory in the batch file it doesn't work ...
set src=f:\test
call "D:\exiftool.exe" -v2 %src% "-filename<CreateDate" -d "%%Y%%m%%d_%%H%%M%%S.%%%%e"
D:\>call "D:\exiftool.exe" -v2 f:\test "-filename<CreateDate" -d "%Y%m%d_%H%M%S.%%e"
======== f:/test/01.MOV
Setting new values from f:/test/01.MOV
Writing File:FileName
======== f:/test/02.JPG
Setting new values from f:/test/02.JPG
Writing File:FileName
======== f:/test/03.MOV
Setting new values from f:/test/03.MOV
Writing File:FileName
======== f:/test/04.JPG
Setting new values from f:/test/04.JPG
Writing File:FileName
1 directories scanned
0 image files updated
4 image files unchanged
What is wrong ?
Thanks for your idea ...
It's been a long time since I wrote batch files on Windows (using a Mac for years now), but have you already tried the command without the trailing % after the %src variable?
No it will be %src% to work find with the variable.
the command line find the good directory, it find 4 files but the renamming action doesn't work.
A shell command give me
d:\>exiftool -v2 f:\test "-FileName<CreateDate" -d "%Y%m%d-%H%M
%S.%%e"
======== f:/test/01.MOV
Setting new values from f:/test/01.MOV
Writing File:FileName
'f:/test/01.MOV' --> 'f:/test/20121010-083900.MOV'
+ FileName = 'f:/test/20121010-083900.MOV'
======== f:/test/02.JPG
Setting new values from f:/test/02.JPG
Writing File:FileName
'f:/test/02.JPG' --> 'f:/test/20121010-084003.JPG'
+ FileName = 'f:/test/20121010-084003.JPG'
======== f:/test/03.MOV
Setting new values from f:/test/03.MOV
Writing File:FileName
'f:/test/03.MOV' --> 'f:/test/20121010-084942.MOV'
+ FileName = 'f:/test/20121010-084942.MOV'
======== f:/test/04.JPG
Setting new values from f:/test/04.JPG
Writing File:FileName
'f:/test/04.JPG' --> 'f:/test/20121010-085351.JPG'
+ FileName = 'f:/test/20121010-085351.JPG'
1 directories scanned
4 image files updated
The batch file give me
set src=f:\test
call "D:\exiftool.exe" -v2 %src% "-filename<CreateDate" -d "%%Y%%m%%d_%%H%%M%%S.%%%%e"
D:\>call "D:\exiftool.exe" -v2 f:\test "-filename<CreateDate" -d "%Y%m%d_%H%M%S.%%e"
======== f:/test/01.MOV
Setting new values from f:/test/01.MOV
Writing File:FileName
======== f:/test/02.JPG
Setting new values from f:/test/02.JPG
Writing File:FileName
======== f:/test/03.MOV
Setting new values from f:/test/03.MOV
Writing File:FileName
======== f:/test/04.JPG
Setting new values from f:/test/04.JPG
Writing File:FileName
1 directories scanned
0 image files updated
4 image files unchanged
I just want to rename my files by the context menu of the directory.
So the path is given by parameter.
If I remove the -d option it give me
D:\>call D:\yquerol\Documents\exiftool -v2 f:\test "-filename<CreateDate"
======== f:/test/01.MOV
Setting new values from f:/test/01.MOV
Writing File:FileName
'f:/test/01.MOV' --> 'f:/test/2012:10:10 08:39:00'
Warning = Error creating 'f:/test/2012:10:10 08:39:00'
Warning: Error creating 'f:/test/2012:10:10 08:39:00' - f:/test/01.MOV
======== f:/test/02.JPG
Setting new values from f:/test/02.JPG
Writing File:FileName
'f:/test/02.JPG' --> 'f:/test/2012:10:10 08:40:03'
Warning = Error creating 'f:/test/2012:10:10 08:40:03'
Warning: Error creating 'f:/test/2012:10:10 08:40:03' - f:/test/02.JPG
======== f:/test/03.MOV
Setting new values from f:/test/03.MOV
Writing File:FileName
'f:/test/03.MOV' --> 'f:/test/2012:10:10 08:49:42'
Warning = Error creating 'f:/test/2012:10:10 08:49:42'
Warning: Error creating 'f:/test/2012:10:10 08:49:42' - f:/test/03.MOV
======== f:/test/04.JPG
Setting new values from f:/test/04.JPG
Writing File:FileName
'f:/test/04.JPG' --> 'f:/test/2012:10:10 08:53:51'
Warning = Error creating 'f:/test/2012:10:10 08:53:51'
Warning: Error creating 'f:/test/2012:10:10 08:53:51' - f:/test/04.JPG
1 directories scanned
0 image files updated
4 files weren't updated due to errors
::)
Try removing the "Call". I believe that's only necessary when you want to call a subroutine or run another batch file from within a batch file and wait for the second batch file to finish before continuing.
Same problem without "call" ...
The call of exiftool is good, because exiftool watch the 4 files ... but it doesn't rename it !!!!
I copied your batch file, with slight changes to allow it to work on my system
set src=X:\!temp\test
call "exiftool.exe" -v2 %src% "-filename<CreateDate" -d "%%Y%%m%%d_%%H%%M%%S.%%%%e"
This version fails:
c:\>test2
c:\>set src=X:\!temp\test
c:\>call "exiftool.exe" -v2 X:\!temp\test "-filename<CreateDate" -d "%Y%m%d_%H%M%S.%%e"
======== X:/!temp/test/test1.jpg
Setting new values from X:/!temp/test/test1.jpg
Writing File:FileName
======== X:/!temp/test/test2.jpg
Setting new values from X:/!temp/test/test2.jpg
Writing File:FileName
1 directories scanned
0 image files updated
2 image files unchanged
If I removed the "Call", it works
c:\>test2
c:\>set src=X:\!temp\test
c:\>"exiftool.exe" -v2 X:\!temp\test "-filename<CreateDate" -d "%Y%m%d_%H%M%S.%%e"
======== X:/!temp/test/test1.jpg
Setting new values from X:/!temp/test/test1.jpg
Writing File:FileName
'X:/!temp/test/test1.jpg' --> 'X:/!temp/test/20140404_040404.jpg'
+ FileName = 'X:/!temp/test/20140404_040404.jpg'
======== X:/!temp/test/test2.jpg
Setting new values from X:/!temp/test/test2.jpg
Writing File:FileName
'X:/!temp/test/test2.jpg' --> 'X:/!temp/test/20150303_030303.jpg'
+ FileName = 'X:/!temp/test/20150303_030303.jpg'
1 directories scanned
2 image files updated
you're right ...
It works !!! ;)