Author Topic: sorting to folders with camera model and renaming  (Read 204 times)

bassam

  • Newbie
  • *
  • Posts: 5
sorting to folders with camera model and renaming
« on: April 01, 2020, 08:30:58 AM »
Good Day..
first of all.. please, excuse my bad English and my newbie question.
I have a large family photos archive (from 2007) but I was too lazy to organize every thing so now I'm stuck with many folders with a lot of photos from many sources..

I tried PhotoMove at first (told you I'm not that smart to use exiftool) but I got a problem with non-English characters.. so back to EXifTool..


I've manged to do this:

Code: [Select]
exiftool -r -o . "-Directory<FileModifyDate" "-Directory<DateTimeOriginal" -d "E:\TargertFolder/%Y/%m/%d/" E:\Source
to copy the photos using date form: Modify Date or Original Date, and put them in folders by: Year/Month/Day..

I tried to add camera Model like this:

Code: [Select]
exiftool -r -o . "-Directory<$FileModifyDate/${model;}" "-Directory<$DateTimeOriginal/${model;}" -d "E:\TargertFolder/%Y/%m/%d/" E:\Source
 but not all photos have camera model info in the EXIF.

my question here, is it possible to use model as optional location, if it's not available ExifTool will copy to Year/Month/Day without model and when it's available Year/Month/Day/Model ??
and can I rename photos while copying them ?

many thnaks...

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: sorting to folders with camera model and renaming
« Reply #1 on: April 01, 2020, 10:16:29 AM »
In the same way that you fall back to using FileModifyDate if DateTimeOriginal is not available, you can fall back to using no Model name if it isn't available.  You can do it like this:

Code: [Select]
exiftool -r -o . "-Directory<FileModifyDate" "-Directory<DateTimeOriginal"  "-Directory<$FileModifyDate/${model;}" "-Directory<$DateTimeOriginal/${model;}" -d "E:\TargertFolder/%Y/%m/%d/" E:\Source
You can rename while copying by writing FileName with the full path name including the desired new file name instead of writing Directory.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bassam

  • Newbie
  • *
  • Posts: 5
Re: sorting to folders with camera model and renaming
« Reply #2 on: April 01, 2020, 04:42:02 PM »
Many thanks.. I'll try it today.

thanks again.. :)

bassam

  • Newbie
  • *
  • Posts: 5
Re: sorting to folders with camera model and renaming
« Reply #3 on: April 02, 2020, 02:17:11 AM »
In the same way that you fall back to using FileModifyDate if DateTimeOriginal is not available, you can fall back to using no Model name if it isn't available.  You can do it like this:

Code: [Select]
exiftool -r -o . "-Directory<FileModifyDate" "-Directory<DateTimeOriginal"  "-Directory<$FileModifyDate/${model;}" "-Directory<$DateTimeOriginal/${model;}" -d "E:\TargertFolder/%Y/%m/%d/" E:\Source
You can rename while copying by writing FileName with the full path name including the desired new file name instead of writing Directory.

- Phil

I used the code, But I noticed that FileModifyDate changed for all files (I didn't do the rename only copying to folders).. is that normal ? I know copying files don't change the modify date in the new file only the create date.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: sorting to folders with camera model and renaming
« Reply #4 on: April 02, 2020, 06:54:41 AM »
Add -P to the command to preserve the original FileModifyDate.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bassam

  • Newbie
  • *
  • Posts: 5
Re: sorting to folders with camera model and renaming
« Reply #5 on: April 03, 2020, 07:38:28 AM »
Many thanks Phil for your help and for making ExifTool..
« Last Edit: April 03, 2020, 08:02:00 AM by bassam »

bassam

  • Newbie
  • *
  • Posts: 5
Re: sorting to folders with camera model and renaming
« Reply #6 on: April 03, 2020, 08:02:06 AM »
It seems that everything is working except when the file is already exists in the destination & I don't know if it's the same name or same photo. I tried to find if it's possible to copy and add number or something if the file is already exists but I failed.. is this possible ?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: sorting to folders with camera model and renaming
« Reply #7 on: April 03, 2020, 08:24:40 AM »
To add a number you must also write the file name, and add "%-c" for a copy number with a leading dash if the same-named file already existed.  So try this:

Code: [Select]
exiftool -r -o . "-FileName<$FileModifyDate/%f%-c.%e" "-FileName<$DateTimeOriginal/%f%-c.%e"  "-FileName<$FileModifyDate/${model;}/%f%-c.%e" "-FileName<$DateTimeOriginal/${model;}/%f%-c.%e" -d "E:\TargertFolder/%Y/%m/%d" E:\Source
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).