Computing.Net > Forums > Disk Operating System > DOS Batch file to FTP files from UNIX

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

DOS Batch file to FTP files from UNIX

Reply to Message Icon

Name: Peter Rimmer
Date: February 2, 2000 at 02:46:28 Pacific
Comment:

I'm trying to write a DOS batch file that will determine which files are in a directory
on a remote unix box and then write a ftp script go 'get' each of the files.

So far I have writen a script that carries out 'ls' on the remote unix box and output the result to a file. The script then uses 'find' to filter out the unwanted filenames. The next part of the script writes a ftp script and outputs the ftp comand 'get' for each of the filenames using a 'for' loop (ie. for /F %%f in (filename) do echo get %%f >> ftpscript). The batch file then executes the ftp script, however when trying to carry out get the error "Cannot open local file X".

The whole script is as below,

@echo off
echo open host > c:\ftp_ls.scr
echo user>> c:\ftp_ls.scr
echo password>> c:\ftp_ls.scr
echo ascii >> c:\ftp_ls.scr
echo ls >> c:\ftp_ls.scr
echo close >> c:\ftp_ls.scr
echo quit >> c:\ftp_ls.scr
ftp -s:c:\ftp_ls.scr > c:\files.lis
echo open host > c:\getfiles.scr
echo user>> c:\sas\dyp\getfiles.scr
echo password>> c:\getfiles.scr
echo ascii>> c:\getfiles.scr
for /F "skip=2" %%f in (c:\sasfiles.lis) do echo get %%f>> c:\getfiles.scr
echo close>> c:\getfiles.scr
echo quit>> c:\getfiles.scr
cd temp
ftp -s:c:\getfiles.scr
cd ..



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: DOS Batch file to FTP files from UNIX

Email from a DOS batch file? www.computing.net/answers/dos/email-from-a-dos-batch-file/4591.html

Dos Batch File Commands www.computing.net/answers/dos/dos-batch-file-commands/11921.html

dos batch file www.computing.net/answers/dos/dos-batch-file/13071.html