Page 1 of 1
FTP transfer with .bat file
Posted: 07 Dec 2008 04:44
by xxxxxx
Hello, i need a .bat file that sends a file from my computer to my ftp.
Could someone write here what i should write in nootepad if i for example need to
upload this file: c:\Program Files\testfile.txt
to my ftp: e.g. ftp.drivers.dr.funpic.org to directory "main" (on my ftp)
if my username is: e.g. master
if my password is: e.g. master0000
sry for my english..
thx
Posted: 08 Dec 2008 16:01
by DosItHelp
xxxxxx,
Code: Select all
@ftp -i -s:"%~f0"&GOTO:EOF
open ftp.drivers.dr.funpic.org
master
master0000
!:--- FTP commands below here ---
ascii
cd main
put "c:\Program Files\testfile.txt"
disconnect
bye
DosItHelp?
Posted: 09 Dec 2008 12:25
by xxxxxx
it doesn't work, but i found this...
http://support.microsoft.com/?scid=kb%3 ... &x=17&y=19 and this works....thank for your reply anyway
Posted: 09 Dec 2008 20:27
by DosItHelp
xxxxxx,
Copy the code from my erlier post into notepad, save as "myftp.cmd" and then run "myftp.cmd" from command line or from explorer.
This is a single file solution where the FTP script is embedded within the batch.
I tried it and got the following output:
C:\Documents and Settings\Dostips>myftp.cmd
ftp> @ftp -i -s:"%~f0"&GOTO:EOF
Invalid command.
ftp> open cmdtips.com
Connected to cmdtips.com.
220 Dot5Hosting FTP Server ready
User (cmdtips.com:(none)):
331 Password required for usr
230 User usr logged in
ftp> !:--- FTP commands below here ---
ftp> ascii
200 Type set to A
ftp> cd main
250 CWD command successful
ftp> put "c:\Program Files\testfile.txt"
200 PORT command successful
150 Opening ASCII mode data connection for testfile.txt
226 Transfer complete
ftp> disconnect
221 Goodbye.
ftp> bye
Let me know if it works for you or send your output to the forum, I would like to see what's wrong.
Thanks,
DosItHelp
Posted: 17 Jun 2009 22:15
by k3lvinmitnick.co.cc
Tks, this topic is helful,
Code: Select all
@ftp -i -s:"%~f0"&GOTO:EOF
open 10.20.30.40
abc123
abc
!:--- FTP commands below here ---
ascii
cd receive
send "c:\rpt\fileDDMMYY.xyz"
disconnect
bye
But, i want to loop it daily :
If system_date=DD then send "c:\rpt\fileDDMMYY.xyz"
E.x: If system_date=30 send "c:\rpt\file30MMYY.xyz"
I need the correct cmd or batch file now, Plz help me ...