Copy Images to Folder Based on Artist Tag

Started by rodertroy, November 02, 2018, 11:23:44 PM

Previous topic - Next topic

rodertroy

Hi!

What is the command to copy jpg and png images to a specific folder based on the name in the exif "Artist" tag?

StarGeek

At the very basic, it would be
exiftool "-Directory<Artist" FileOrDir

If you need to specify the path
exiftool "-Directory<C:/path/to/$Artist" FileOrDir
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

rodertroy

#2
Thank you for the quick reply!

I use linux btw, so I changed the double quotes to single. "adgas" is the directory I want to scan, and I want to copy the particular images to the "album" folder. Did I insert the directory paths correctly? And where do I input the tag for Artist? One of the Artist tags I want copied is "cherrytree".

exiftool '-Directory</home/pop/Downloads/red/adgas/$Artist' /home/pop/Downloads/red/adgas/album

Incidentally my exiftool version is libimage-exiftool-perl 10.80-1 on Linux Mint 19 64-bit.

StarGeek

Quote from: rodertroy on November 02, 2018, 11:50:34 PM
I use linux btw, so I changed the double quotes to single.

Good to see you pay attention :D

QuoteDid I insert the directory paths correctly?

It looks like it will work to me, but it's up to you to decide if they're right.

You can test it to see if it works with this command.  It won't move any files but will show you what the results of the move would be.
exiftool '-TestName</home/pop/Downloads/red/adgas/$Artist/%F' /home/pop/Downloads/red/adgas/album

QuoteAnd where do I input the tag for Artist?
The EXIF tag for the Artist is Artist, so where ever you want it, you can put $Artist.  But the tag in a png file may not have the same name.  I don't usually use png files, so I can't remember offhand.  You'll have to run exiftool -g1 -a -s on the file to verify the correct tag name.

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

rodertroy

I have many image files, mainly jpgs, so the name for ARTIST will vary. Some of the names are cherrytree, pinetree, oaktree, etc. All of these different names are categorized under the ARTIST tag.

Where in the above command do I specify that I only want jpgs with "cherrytree" copied to the other folder?

StarGeek

Quote from: rodertroy on November 03, 2018, 01:13:07 AM
Where in the above command do I specify that I only want jpgs with "cherrytree" copied to the other folder?

Ah, ok, now I understand.

Add this to the command:
-if '$Artist=~/cherrytree/i'
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

I realized that I may have misunderstood what you wanted to do.  The directions I gave were how to move files. 

Did you want to make new copies of the files?  So you would have the original file in /home/pop/Downloads/red/adgas/album and a second copy in /home/pop/Downloads/red/adgas/cherrytree

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

rodertroy

#7
Yes I want them copied, and not moved. But if you can give me directions for both moving and copying I'd appreciate it. For now I'm interested in copying, but I may want to move image files at some future date.

Where in the command would I place -if '$Artist=~/cherrytree/i'?

exiftool '-Directory</home/pop/Downloads/red/adgas/$Artist' /home/pop/Downloads/red/adgas/album

I've tried various positions but come up with this response:


    1 directories scanned
    0 image files read





rodertroy

I figured out how to move them:

exiftool -if '$Artist=~/cherrytree/i' -directory=album /home/pop/Downloads/red/adgas/

Now just need to know how to copy them.


Hayo Baan

Quote from: rodertroy on November 03, 2018, 03:17:07 AM
Yes I want them copied, and not moved. But if you can give me directions for both moving and copying I'd appreciate it. For now I'm interested in copying, but I may want to move image files at some future date.

Where in the command would I place -if '$Artist=~/cherrytree/i'?

The -if can go anywhere on the command-line.

Quote from: rodertroy on November 03, 2018, 03:17:07 AM
exiftool '-Directory</home/pop/Downloads/red/adgas/$Artist' /home/pop/Downloads/red/adgas/album

I've tried various positions but come up with this response:


    1 directories scanned
    0 image files read


Are there any images that actually have the artist tag set?

What does
exiftool -artist /home/pop/Downloads/red/adgas/album
say?

Note, to copy instead of move, you can use the -o . option
Hayo Baan – Photography
Web: www.hayobaan.nl

rodertroy

Thanks for the help guys!

This command will recursively copy images with the name "cherrytree" in the artist exif tag to the folder named "album":

exiftool -r -o . -if '$Artist=~/'cherrytree'/i' '-directory=album' /home/pop/Downloads/red/adgas

Is the following part of the above command necessary?

/home/pop/Downloads/red/adgas

Since I'm running the command in a terminal that is working within the folder that stores the images is it possible to do without that part?

StarGeek

You need the name of the directory that you're operating on.  If the current directory is the one you're going to be reading, then you can use a dot . to indicate the current directory.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype