Ignore symlink files

Started by Thon, November 18, 2022, 06:45:46 PM

Previous topic - Next topic

Thon

I currently have a exiftool oneliner that moves photos from an ingest folder in to a year/month/day which works great
exiftool -r '-filename<./$createdate' -d "%Y/%m_%b/%Y_%m_%d_%Hh%Mm%
Ss%-02.c.%%e" .

But I'm now looking to expand it to do something a bit different. I'm wanting to sync photos from android phones. But store them on the server in the year/month/day format above. My idea is to sync a directory to an SMB share on the server and use exiftool to move the images to the year/month/day structure whilst leaving a symlink behind pointing to the new file. This is working from the android side as it just sees the files and syncs/deletes what it need to do. I was going to bash script it, but I've managed to get it nearly all in one line

exiftool -v IMG_20221118_150716.jpg '-filename<./$createdate' -d "%Y/%m_%b/%Y_%m_%d_%Hh%Mm%Ss%-02.c.%%e" | sed -n 3p | cut -d"'" -f 2,4 --output-delimiter=' ' | xargs -l bash -c 'ln -s $0 $1'
I just didn't want to search for each non symlink file then loop over the list calling exiftool each time. Unless I'm missing something with bash scripting. Is there any way to make exiftool ignore a symlink file so I can run this on a directory?

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Thon

The -I option look like it only works on symlink directory's, does it work on files as well?

StarGeek

Ah, yes, you are correct.

Try
-if '$FileAttributes!~/Symbolic Link/'
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

If there are a lot of symlinks in the directory, using -if5 instead of -if should speed things up a lot.

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