News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

File re-naming issue

Started by jiraju, February 09, 2019, 02:37:20 AM

Previous topic - Next topic

jiraju

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

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jiraju

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

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hayo Baan

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

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

Quote from: Hayo Baan 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?

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

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).