ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Thon on November 18, 2022, 06:45:46 PM

Title: Ignore symlink files
Post by: Thon on November 18, 2022, 06:45:46 PM
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?
Title: Re: Ignore symlink files
Post by: StarGeek on November 18, 2022, 07:05:48 PM
See the -i (Ignore) option (https://exiftool.org/exiftool_pod.html#i-DIR--ignore).
Title: Re: Ignore symlink files
Post by: Thon on November 18, 2022, 07:09:51 PM
The -I option look like it only works on symlink directory's, does it work on files as well?
Title: Re: Ignore symlink files
Post by: StarGeek on November 18, 2022, 09:00:26 PM
Ah, yes, you are correct.

Try
-if '$FileAttributes!~/Symbolic Link/'
Title: Re: Ignore symlink files
Post by: Phil Harvey on November 18, 2022, 09:18:10 PM
If there are a lot of symlinks in the directory, using -if5 instead of -if should speed things up a lot.

- Phil