FTP transfer with .bat file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
xxxxxx
Posts: 2
Joined: 07 Dec 2008 04:34
Location: --

FTP transfer with .bat file

#1 Post by xxxxxx » 07 Dec 2008 04:44

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

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 08 Dec 2008 16:01

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? :wink:

xxxxxx
Posts: 2
Joined: 07 Dec 2008 04:34
Location: --

#3 Post by xxxxxx » 09 Dec 2008 12:25

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

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#4 Post by DosItHelp » 09 Dec 2008 20:27

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

k3lvinmitnick.co.cc
Posts: 6
Joined: 17 Jun 2009 20:17
Location: http://vietdzung.net
Contact:

#5 Post by k3lvinmitnick.co.cc » 17 Jun 2009 22:15

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

Post Reply