ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: klind on October 14, 2019, 08:24:23 PM

Title: Moving Some Files
Post by: klind on October 14, 2019, 08:24:23 PM
I have a directory structure like this:

   Dir1
   Dir2
      Sdir1
      SDir2
        Etc

I want to move recursively all files that have invalid DateTimeOriginal to a Temp sub-directory below each existing (Sub)Directory. So that I will get something like this:

   Dir1
      Temp
   Dir2
      Temp
      Sdir1
         Temp
      SDir2
         Temp
        Etc
            Temp

I am trying to use the following command line:

   exiftool -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' "-Directory=temp/" -overwrite_original -r. .

But instead I am getting everything pushed into the first level Temp directory like this:

   Dir1
      Temp <--- Everything is going here!
   Dir2
      Sdir1
      SDir2
        Etc

What am I doing wrong?
Title: Re: Moving Some Files
Post by: StarGeek on October 14, 2019, 08:29:21 PM
Try using
"-Directory<$Directory/temp/"
Title: Re: Moving Some Files
Post by: klind on October 14, 2019, 09:30:16 PM
If you mean like this:

exiftool -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' "-Directory<$Directory/temp/" -overwrite_original -r. .

That didn't create or move anything.
Title: Re: Moving Some Files
Post by: StarGeek on October 14, 2019, 10:09:23 PM
Sorry, I didn't notice you were using single quotes in your first post.  I'm assuming that means you're on Linux/Mac.  If so, swap the quotes in the example I gave.  Using double quotes when there's a dollar sign in the argument causes bash to believe that there is a bash variable in the command.
Title: Re: Moving Some Files
Post by: klind on October 14, 2019, 10:17:57 PM
Got it... On Mac have to use single quotes:

exiftool -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00"))' '-Directory<$Directory/temp/' -overwrite_original -r. .

Thanx