ExifTool Forum

ExifTool => Newbies => Topic started by: engltayl on April 22, 2018, 09:06:11 AM

Title: copying from one directory to another using metadata -model
Post by: engltayl on April 22, 2018, 09:06:11 AM
Hi,

Really struggling trying to do the following. Can anybody help?

I would like to move all files from one directory (and sub directories) which have a tag (camera model = Nikon D90) to another directory. I've had some success with the following except it copies instead of moves. It also seems to lose the metadata for NEF files.

exiftool -r -model='NIKON D90' '/volume1/backup drive/test1' -o '/volume1/backup drive/test2'

Many Thanks
Title: Re: copying from one directory to another using metadata -model
Post by: StarGeek on April 22, 2018, 10:54:07 AM
With -model='NIKON D90', you are setting the Model tag to a value of "NIKON D90".  What I think you want is to move the file if the model is equal to NIKON D90, right?  If that's the case, you want a command something like this:
exiftool -r -if '$Model eq "NIKON D90" -Directory=/volume1/backup drive/test2 /volume1/backup drive/test1
Title: Re: copying from one directory to another using metadata -model
Post by: engltayl on April 22, 2018, 02:04:13 PM
Great. Thanks for the help. It nearly works but it seems to fail on condition. There are definitely files in the DIR with model=NIKON D90. Cant figure out why it keeps failing condition.

exiftool -r -if '$model eq "NIKON D90"'' -directory=/volume1/backup drive/test2' '/volume1/backup drive/test1'
    1 directories scanned
   39 files failed condition
    0 image files read
Title: Re: copying from one directory to another using metadata -model
Post by: Hayo Baan on April 22, 2018, 02:28:43 PM
What does exiftool -model way for your files? The match must be exact to work.
Title: Re: copying from one directory to another using metadata -model
Post by: StarGeek on April 22, 2018, 03:04:11 PM
Quote from: engltayl on April 22, 2018, 02:04:13 PM
exiftool -r -if '$model eq "NIKON D90"'' -directory=/volume1/backup drive/test2' '/volume1/backup drive/test1'

You have too many quotes here.  After D90, you have (Doublequote)(Singlequote)(Singlequote).  It should just be (Doublequote)(Singlequote).

Here's an alternate command to try:
exiftool -r -if '$model=~/NIKON D90/i' -directory=/volume1/backup drive/test2' '/volume1/backup drive/test1'

The =~ structure uses Regular Expressions (RegEx) to test for a match if you're familiar with them.  This works well for simple alphanumeric strings but becomes more complex if you need to use other characters like slashes, brackets, or parenthesis.
Title: Re: copying from one directory to another using metadata -model
Post by: engltayl on April 22, 2018, 03:33:08 PM
Thanks for the help. The following seems to work:

exiftool -r -if '$model eq "NIKON D90"' -directory='/volume1/backup drive/test2' '/volume1/backup drive/test1'