Perl/ExifTool Script not Running

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Perl/ExifTool Script not Running Sat Jul 29, 2023 12:06 pm • by Geoff_12889
I'm trying to get a Perl script to work within Hazel. I am calling ExifTool to help with this function. When I run this command in terminal, it works as expected, but when running through Hazel, it does not. The process checks each file in the directory the JPG is located to see if there is a RAW file with the same name, and if so, the JPG is moved into a "JPEG Backup" folder.

I think the issue is that the function errors on each file that does not match. In terminal, I can just ignore these errors, but Hazel may not finish the script because of the errors. I tried using "exit 0;" to force the script to run, but that doesn't help. Here is the code I am running and a screenshot of the setup within Hazel.

Any assistance is much appreciated.

Code: Select all
my $path = $1;
$path =~ s{/\d{4}-\d{2}-\d{2} __ \d{2}.\d{2}.\d{2} __ \w+ __ \w+\.\w{3}$}{};

exec("/usr/local/bin/exiftool --ext jpg -directory=\"%dJPEG Backup\" -srcfile %d%f.jpg \"$path\"");
exit 0;


Image
Geoff_12889
 
Posts: 1
Joined: Sat Jul 29, 2023 11:48 am

Re: Perl/ExifTool Script not Running Mon Jul 31, 2023 8:42 am • by Mr_Noodle
Not sure what the issue is here? If the file doesn't match, what's wrong with failing the script? When it does match, it will execute the actions. BTW, unclear on the 2nd line of your script but I'm guessing you're doing some sort of regex matching. If so, have you tried using Hazel's built-in pattern matching? Having it in a condition makes more sense than in an action.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support