Ftp script


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
 
Ad

Advertisements

P

Phil Robyn

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
 
Ad

Advertisements

A

Al Dunbar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top