peter
11-04-2005, 11:56 AM
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
Phil Robyn
11-05-2005, 12:22 AM
peter wrote:
> 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 [Microsoft MVP]
University of California, Berkeley
Al Dunbar
11-08-2005, 02:12 AM
"Phil Robyn" <probyn@berkeley.edu> wrote in message
news:%23q2CK8Z4FHA.3976@TK2MSFTNGP15.phx.gbl...
> peter wrote:
>> 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
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