I use shell scripting to make this work.
My setup is quite complicated, but for your purposes I would think something along the lines of:
- Code: Select all
extension is .m4v
date last modified is not in the last 1 minute
passes shell script
NAME=$(basename "$1" .m4v)
if [ ! -e "$NAME" ]
then exit 1
fi
This will match your m4v file, 1 minute after it has finished processing and will only trigger if the original file exists in the same directory with the same name, less the .m4v extension. You could remove the 1 minute rule, but then you would risk the rule triggering before the file is finished processing.
I then use the shell to delete the original. Using shell scripts (or applescript) is the only way i've found to get hazel to act on a file other than the one that was matched.
- Code: Select all
NAME=$(basename "$1" .m4v)
rm "$NAME"
Important to note here, that rm is unforgiving. The file is deleted immediately, which can be annoying if your m4v gets corrupted during processing.
If you'd rather move the originals to the trash and delete them manually when you are sure the conversion has worked, you can replace the rm command with a mv command.
- Code: Select all
mv "$NAME" ~/.Trash