Author Topic: File re-naming issue  (Read 764 times)

jiraju

  • Newbie
  • *
  • Posts: 4
File re-naming issue
« on: February 09, 2019, 02:37:20 AM »
Hi All,

First of all thank to Phil and other people for great tool and great help in this forum.
With the help of FAQ and other post i learned many things about this tool.

I created one small script to move my photos based on my folder structure
                                ModelName="$($exiftool -s3 -Model "$f")"
            $exiftool -P -v \
               '-FileName<CreateDate' -d "$EXPORTPATH/%Y/$ModelName/%Y%m%d_%H%M%S%%+.2c.%%e" \
               '-FileName<DateTimeOriginal' -d "$EXPORTPATH/%Y/$ModelName/%Y%m%d_%H%M%S%%+.2c.%%e" \
               "$f"
This works perfectly fine if i give my original photos. If i give photos which are already renamed by this script then its doesn't move photos based on this script. I compared meta data or original file and meta data of photo which is out of this scripts look same.
I donot want to modify any meta data from my image file.
Can any one help me on that?

I am using Mac OS and shell script.
 

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18253
    • ExifTool Home Page
Re: File re-naming issue
« Reply #1 on: February 09, 2019, 08:20:17 AM »
This should work on the renamed file.  Are you sure $EXPORTPATH is getting set properly?

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

jiraju

  • Newbie
  • *
  • Posts: 4
Re: File re-naming issue
« Reply #2 on: February 09, 2019, 11:01:26 AM »
Yes it’s setting up properly. I tried to add if else condition based on model name.

If model is canon
       Move to canon folder using Exiftool
Else
       Move to other folder using exiftool

So first time when I run with original file then it goes to if condition but when I give file already moved & renamed by script then always it goes to else condition.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18253
    • ExifTool Home Page
Re: File re-naming issue
« Reply #3 on: February 09, 2019, 11:53:40 AM »
If you can provide me with enough information to reproduce this effect here then I can figure out what is happening.

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

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: File re-naming issue
« Reply #4 on: February 10, 2019, 03:21:14 AM »
Have you checked to see if the images your are working with indeed contain the metadata on which you are deciding the move?
Hayo Baan – Photography
Web: www.hayobaan.nl

jiraju

  • Newbie
  • *
  • Posts: 4
Re: File re-naming issue
« Reply #5 on: February 10, 2019, 01:10:59 PM »
Here is my Shell script.

export EXIFTOOL=/usr/local/bin/exiftool
EXPORTPATH=../../../.."$1"
for f in "${@:2}"
do
   ModelName="$($EXIFTOOL -s3 -Model "$f")"
   case $ModelName in
      "Canon EOS 60D")
         $EXIFTOOL -P \
            '-FileName<CreateDate' -d "$EXPORTPATH/%Y/%Y-%m-%d/$ModelName/%Y%m%d_%H%M%S.%%e" \
            '-FileName<DateTimeOriginal' -d "$EXPORTPATH/%Y/%Y-%m-%d/$ModelName/%Y%m%d_%H%M%S.%%e" \
            "$f"
         ;;
      "iPhone 8")
         $EXIFTOOL -P \
            '-FileName<CreateDate' -d "$EXPORTPATH/%Y/%Y-%m-%d/$ModelName/%Y%m%d_%H%M%S.%%e" \
            '-FileName<DateTimeOriginal' -d "$EXPORTPATH/%Y/%Y-%m-%d/$ModelName/%Y%m%d_%H%M%S.%%e" \
            "$f"
         ;;
      *)
         $EXIFTOOL -P \
            '-FileName<CreateDate' -d "$EXPORTPATH/%Y/%Y-%m-%d/Other/%%e/%%f.%%e" \
            '-FileName<DateTimeOriginal' -d "$EXPORTPATH/%Y/%Y-%m-%d/Other/%%e/%%f.%%e" \
         "$f"
         ;;
   esac
   #sleep 1
done

jiraju

  • Newbie
  • *
  • Posts: 4
Re: File re-naming issue
« Reply #6 on: February 10, 2019, 01:14:15 PM »
Have you checked to see if the images your are working with indeed contain the metadata on which you are deciding the move?

Yes, i ran command on terminal for original image and moved image. all meta data is same. But i am not sure if i give moved image again to same script then why its not moving the already moved file as per rules.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18253
    • ExifTool Home Page
Re: File re-naming issue
« Reply #7 on: February 10, 2019, 01:45:53 PM »
What is the command line you use to run your script?  You need to use the new file names the second time you run it.

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