Computing.Net > Forums > Unix > shell script to check for a file on

shell script to check for a file on

Reply to Message Icon

Original Message
Name: CM
Date: August 28, 2002 at 07:52:39 Pacific
Subject: shell script to check for a file on
Comment:

Hi,
I'm trying to create a shell script to check for the existence of a file on an NT box prior to an FTP process. If it doesn't exist then the process sleeps. Can anyone help? Thanks.

Cherian


Report Offensive Message For Removal

Response Number 1
Name: Jerry Lemieux
Date: August 28, 2002 at 13:11:01 Pacific
Subject: shell script to check for a file on
Reply: (edit)

This is a unix forum, not an NT forum. On Unix, it would be a simple matter of including the following in your script:

if [ -f $filename ]
then
ftp the file
else
print "Da file ain't there"
fi

$filename is a variable that holds the name of some file. You can also hardcode it if the file name is always the same. On NT, don't you have to write a batch file with the "if exists" syntax or something like that? I try and stay away from "Billyware" as much as possible.

Jerry


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: shell script to check for a file on

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software