Ftp script

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I need a script to do the following.....

ftp file from my c: drive (called test.txt)to our server (10.1.1.1).
However what I do need is some file checking.

ie does the file exist on the C:drive.
If it does exist how do I check on the remote system for the file. I need
to alert the user if it does/not exist.

Hope somebody can help I know the basics but struggle with file checking.

Thanks

Peter
 
peter said:
Hi All,

I need a script to do the following.....

ftp file from my c: drive (called test.txt)to our server (10.1.1.1).
However what I do need is some file checking.

ie does the file exist on the C:drive.
If it does exist how do I check on the remote system for the file. I need
to alert the user if it does/not exist.

Hope somebody can help I know the basics but struggle with file checking.

Thanks

Peter

Check for the existence of the local file by

if exist c:\yourpath\test.txt ...

For the remote file, use FTP to write a listing of the
remote directory on the local machine

dir filename c:\temp\remotedirectory.txt

and then use findstring to see whether 'filename' is in
c:\temp\remotedirectory.txt
 
Phil Robyn said:
Check for the existence of the local file by

if exist c:\yourpath\test.txt ...

For the remote file, use FTP to write a listing of the
remote directory on the local machine

dir filename c:\temp\remotedirectory.txt

and then use findstring to see whether 'filename' is in
c:\temp\remotedirectory.txt

Most commands will work on UNC's, so why not try this:

if exist \\server\share\folder\file.ext (
echo/file exists on remote server
) else (
echo/file does NOT exist on remote server
)

/Al
 
Back
Top