testing if a file is present
David I. Berg
dberg at informix.com
Thu Nov 22 02:51:49 AEST 1990
In article <ger.659126250 at prisma> ger at prisma.cv.ruu.nl (Ger Timmens) writes:
>Can anybody tell me how I can verify whether a file exists or not ?
>I want to move files and only when they exist ! mv "file" gives an
>error message if "file" not exists
if (-f filename) will return true if the file exists, false if not.
There are many other options for which you can also test:
-d if filename is a directory,
-z if filename is zero length,
-w if filename is writable,
etc.
RTFM!
More information about the Comp.unix.shell
mailing list