[K12OSN] OT: bash scripting - check for permissions, check for existence of file in directory tree

Rob Owens rob.owens at biochemfluidics.com
Wed Sep 24 11:49:42 UTC 2008

Nils Breunese wrote:
> Rob Owens wrote:
>> Nils Breunese wrote:
>>> Rob Owens wrote:
>>>> 2) I need to check for the existence of a file somewhere in a directory
>>>> tree (with lots of subdirectories).
>>> ----
>>> find <directory> -name <filename>
>>> ----
>> I thought of that, but suspected there might be a better way.  Guess I
>> was wrong.
> Better in what way?
I'm not actually looking to find a file and output it, I need to perform
some action if a file exists.  Since I don't know where the file is, I
guess I've got to find it first...

I was hoping there would be a recursive way of doing:  if [ -f $FILE ];
then  (or some other one-liner).


The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy


More information about the K12OSN mailing list