FTP from command line

  • Thread starter Thread starter Amitava Banerjea
  • Start date Start date
A

Amitava Banerjea

I need to schedule a ftp procedure on a Win2k server to
put a file on another server. What's the best way to do
this? I was planning to use a .bat file to wrap the ftp
commands but how do I login from the bat file? Is there a
simpler or cleaner way to do this?
 
That is the method I use. Example: (Quote from me from some time ago)


"This isn't the best method in the world, I'd imagine, but this is what
I do when I have to upload pages overnight while I'm sleeping. It
hasn't failed me yet.

Create a text file with contents as such: (I name the file with a
..ftp file extension, but it doesn't matter)

--------------------------------------
open xxx.xxx.xxx.xxx
user REPLACETHISWITHYOURUSERNAME
REPLACETHISWITHYOURPASSWORD
type ascii
lcd D:\LocalDirectory
cd RemoteDirectory
get pagename.asp
! net send %computername% Files updloaded
close
quit
--------------------------------------

Then, open up your command prompt (cmd.exe) and enter a line like one
of the examples below to schedule the ftp session

To have it run at 11:59 on the current day:
at 23:59
%windir%\system32\ftp.exe -n -s:D:\PathToFTPFile\ftpfilename.ftp

To have it run on the night of the 25th of the month:
at 23:59 /next:25
%windir%\system32\ftp.exe -n -s:D:\PathToFTPFile\ftpfilename.ftp
"

Ray at work
 
Since you're using it, too, maybe you know where can I get
a replacement file for FTP.EXE ? The file has
disappeared, I suspect it happened after doing a Windows
automatic update!
 
You can easily get it back from the i386 folder on your
Win2000 CD, using expand.exe.
 
Just a little more detail.

expand CDROMDrive\I386\ftp.ex_ %systemroot%\system32\ftp.exe

Enter that at the command prompt with your W2K CD in the drive, and replace
CDROMDrive with your CD ROM drive letter, i.e. D:.

Ray at work
 
Back
Top