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

DOS Batch file to FTP files from UNIX

Reply to Message Icon

Original Message
Name: Peter Rimmer
Date: February 2, 2000 at 02:46:28 Pacific
Subject: DOS Batch file to FTP files from UNIX
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 ..


Report Offensive Message For Removal








Use following form to reply to current message:

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

Subject: DOS Batch file to FTP files from UNIX

Comments:

 


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




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge