I want to do some works.
First, rename digital camera files(jpg ext) along with createdate and camera model and maker(ex, 20170809-123215DMC-Fx10Panasonic.jpg).
Second, make directory with CameraModel(ex, DMC-Fx10).
Third, create year\months sub directory under CameraModel directory(ex, DMC-Fx10)
Fourth, move renamed files to year\months directory.
Thanks.
This command should do what you want:
exiftool "-filename<${model;}/${createdate;DateFmt('%Y/%m')}/$createdate${model;}${make;}%-c.%e" -ext jpg -d "%Y%m%d-%H%M%S" DIR
You should run this from the directory where you want the other directories to be created. I have added a %-c to avoid name conflicts in the case that two pictures have the same date/time.
First run the command using "testname" instead of "filename" to be sure it is doing what you want before actually renaming/moving the files.
- Phil
Thanks.
Your script work well.
It makes directory included model and file rename included model and make.
But two minor problem is.
First, every file has its own directory.
So, if one original directory has 1170 jpg files, there are 1170 sub directories which have its own directory name and every sub directories has only one file.
Camera Model(DMC-FX10) - createdate(20090312-004421) - createdateModelMake(20090321-004421DMC-FX10Panasonic.JPG)
DMC-FX10 - 20090321-004414 - 20090321-004414DMC-FX10Panasonic.JPG
DMC-FX10 - 20090321-004421 - 20090321-004421DMC-FX10Panasonic.JPG
DMC-FX10 - 20090321-004438 - 20090321-004438DMC-FX10Panasonic.JPG
.
.
I want to gather files which were took same month in one directory(ex, 200903) .
Second, script shows error message.
Warning: Global symbol "%Y" requires explicit package name (did you forget to declare "my %Y"?) at (eval 110442) line 1.
Global symbol "%m" requires explicit package name (did you forget to declare "my %m"?) for 'createdate' - ./20093To2011506/20090715/P1050789.JPG
.
.
.
Is it minor?
Thanks.
I think you need to add a hashmark to use the DateFmt option.
"-filename<${model;}/${createdate#;DateFmt('%Y/%m')}/$createdate${model;}${make;}%-c.%e"
Otherwise the command should work properly. Are you using -Filename, not -Directory? What OS are you using? If you are on Mac/Linux, swap double/single quotes.
Right. Thanks StarGeek. I forgot to start from the unformatted creation date (CreateDate#).
- Phil
Thanks StarGeek and Phill.
The result with "createdate#" is same.
One image file has its own directory. But, this time sub directory's name is some different.
DMC-FX10 - 2009:03:21 00:44:14 - 20090321-004414DMC-FX10Panasonic.JPG
And same warning message appears.
My system is linux, so I swap double to single quotes.
If I replace "-filename" with "-Directory", another subdirectory appears and no rename happens(remain original jpg file name).
DMC-FX10 - 2009:03:21 00:44:14 - 20090321-004414DMC-FX10Panasonic.JPG - P1050003.JPG
Can you post the command you used? Did you also swap the single quotes back to double quotes?
- Phil
If I use,
exiftool '-filename<${model;}/${createdate#;DateFmt('%Y/%m')}/$createdate${model;}${make;}%-c.%e' -ext jpg -d '%Y%m%d-%H%M%S' .
The result
DMC-FX10/2009:07:15 03:37:51/20090715-033751DMC-FX10Panasonic-1.JPG
If I use it without #
exiftool '-filename<${model;}/${createdate;DateFmt(%Y/%m)}/$createdate${model;}${make;}%-c.%e' -ext jpg -d '%Y%m%d-%H%M%S' .
The result
DMC-FX10/20090711-091708/20090711-091708DMC-FX10Panasonic.JPG
My system is ubuntu 18.0.4.
Thanks.
Swap the single quotes after DateFmt to double quotes.
exiftool '-filename<${model;}/${createdate#;DateFmt("%Y/%m")}/$createdate${model;}${make;}%-c.%e' -ext jpg -d '%Y%m%d-%H%M%S' .
Fantastic!!!
It works well.
The result is
DMC-FX10/2009/03/20090321-004414DMC-FX10Panasonic.JPG
And each month sub directory (ex, 2009/03) has all files which were took same month(ex, 2009/03).
Thanks.