Computing.Net > Forums > Disk Operating System > dos batch to ftp files

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 to ftp files

Reply to Message Icon

Name: Thomas Ducusin
Date: December 14, 1999 at 23:22:19 Pacific
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: Rick Payton
Date: December 15, 1999 at 12:43:33 Pacific
Reply:

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


0

Response Number 2
Name: Richard Sia
Date: July 17, 2000 at 11:48:41 Pacific
Reply:

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


0

Response Number 3
Name: Jim Smith
Date: July 24, 2000 at 09:58:35 Pacific
Reply:

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.cmd

And that should do it!!


0

Response Number 4
Name: Michael Jennings
Date: December 11, 2000 at 04:38:36 Pacific
Reply:

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 ?


0

Response Number 5
Name: Jerry Goodson
Date: December 16, 2000 at 21:09:49 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: Michael Necklen
Date: December 20, 2000 at 07:57:35 Pacific
Reply:

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
quit

My 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.


0

Response Number 7
Name: adrian
Date: January 17, 2001 at 17:30:01 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon






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 to ftp files

DOS batch to check file dates www.computing.net/answers/dos/dos-batch-to-check-file-dates/13578.html

dos batch to check file date www.computing.net/answers/dos/dos-batch-to-check-file-date/12627.html

Printing From A DOS App. To A File www.computing.net/answers/dos/printing-from-a-dos-app-to-a-file/1730.html