Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Windows 95/98 has an ftp program that can be executed via the dos shell. Does anyone have a dos batch file that can execute the ftp program to transfer *.csv files in a given directory?

Ok, you want to use a batch file to call the ftp.exe program to transfer files to/from a server? peice of cake .... first the script that ftp.exe reads, lets call it SITE.SCR (you can name it anything you like actually), and here's it's contents:
---
open ftp.site.com
loginname <- this is YOUR login name
password <- your password goes here
bin
lcd c:\temp <- change to in/out dir. to send/receive files on YOUR hard drive
cd temp <- this is the directory on ftp server that you send/receive files to
mget * <- gets ALL files from ftp dir.
mput * <- puts ALL files form local fir.
mdele * <- deletes all files from ftp dir.
bye <- logs you out
---then your batch file:
@echo off
ftp.exe -s:SITE.SCR
cd\temp
del *.* (only if you need/want to delete local copies of transfered files)
exit
---If you want I can give you a very specific script, as this is just a very generalized one. basically an ftp script file is one command per line.
Rick

Hi Rick,
My name is Richard and I stumbled across your ftp using batch files response
in the computing.net forum. I was wondering if you could please answer a
couple questions for me.Firstly, could I pass arguments to ftp using a batch file? Currently, you
are using a .SCR file to hold all the arguments which your .BAT file uses to
ftp. But, for example, if the server IP/name changes, one might have to
change 30+ .SCR files! Is there a way to give generic "variables" for the
user to fill in to ftp a file via a batch file?Second, is there a way to check if the ftp was successful or not?
Specifically, could you send a short msg. to an e-mail acct. saying whether
the ftp was successful/unsuccessful?Thanks so much for your help on this Rick.
Richard

The only way I know of to pass parameters, is to actually build the FTP command file from your batch file. In your batch file, you know what file you want to transfer. So, have DOS write out a command file and then issue the FTP command to use that file.
echo MyID>ftp.cmd
echo Mypwd>>ftp.cmd
echo bin>>ftp.cmd
echo put %1>>ftp.cmd
echo bye>>ftp.cmd
ftp -s:ftp.cmdAnd that should do it!!

Hi, I'm trying to use mput to send the contents of a directory to another box but it only sends one file and then looks for confirmation i.e. it needs a 'y' to be typed.
Any ideas ?

I found that if you add the "prompt" command in your script immediately after your login and pw, it will not prompt you for confirmations on file transfers.

Hi I need help along the lines of this topic if anybody knows the answer please email me @ michaelnecklen@hotmail.com My question is I have a batchfile that reads: ftp -n -s:filename 10.10.0.0
The filename file reads:
user username password
cd test
bin
stat
get nyMMDDse
get nyMMDDua
quitMy question is it possible to have the MMDD section of the get command be changed to the next days date after it has been executed for that day?? In an automated fashion, without having to manually edit the file in dos everyday. Thanks in advance for the help.

I need to ftp a single, local file to 300+ remote directories. All directories are directly off of a single directory. Could someone help me figure out the best way to accomplish this? I would really appreciate it! Thanks! Please email: adrian@mcmillian.com

![]() |
![]() |
![]() |

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