Page 1 of 1

check absence of file with "passes shell script"

PostPosted: Mon Nov 04, 2013 6:14 pm
by Graf_Wetter
Hi,

I want a rule to be executed only if a file in a specific folder and its subfolders (not the matched folder) does not exist.
In Terminal, i can check it with:
find /path/to/file/ -name filename.pdf

How can this command be put in a "passes shell script"- script ?

Thanks for any help.

Graf Wetter

Re: check absence of file with "passes shell script"

PostPosted: Tue Nov 05, 2013 11:34 am
by a_freyer
Code: Select all
if [ ! -f "/path/to/file" ]; then exit 0; else exit 1; fi

Re: check absence of file with "passes shell script"

PostPosted: Thu Nov 14, 2013 7:52 am
by Graf_Wetter
a_freyer,
thanks!
The script works great with some modifications for my needs.
That was very helpful, as always …
Graf_Wetter