Forum Moderators: coopster & phranque

Message Too Old, No Replies

condition that a file doesn't exist

I know about -e, but how about not existing?

         

adni18

11:37 pm on Dec 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi. Is there a condition that checks to make sure a file doesn't exist?

rocknbil

2:00 am on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if (! -e $file) { print "oops, maybe I should upload it."; }

-e = exists

Or better yet,

if (! -f $file) { print "oops, that's a folder name."; }

-f = is ordinary file

Edit: after a re-read (I hate it when I do that) if you're trying to verify the file's not there, you could just do

if (-f $file) { sleep 1; &check_again; }

adni18

11:00 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks!