Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to write a batch file that will Upload and update a specific set of file on my desktop to an FTP account, so I wrote this batch:

@ftp -i -s:"%~f0"&GOTO:EOF
open DomainName.com
USERNAME
PASSWORD
binary
cd  httpdocs/myfiles
lcd F:\Test\Folder1
mput *.bmp
close
quit

by testing the above batch, everything work good until it reaches the line:

mput *.bmp

once this line is reached, connection freeze and the only way to resume after that is by restarting the router

So can someone please help me by telling me what exactly I am doing wrong here?

Update: 1. FTP server I am trying to upload to is Linux based (CentOS) 2. I am using a Windows XP - SP1 machine to execute this batch file 3. I've tried clicking CTRL+C to terminate the batch but still, even though the batch is terminated the connection remain freezed until I restart the router

Update 2: Here is the exact output of the commands I enter:

ftp
open domainname.com
220 ProFTPD 1.3.4a Server <ProFTPD> [IP ADDRESS of our server]
User <domainname.com:<none>>: USERNAME
331 Password required for USERNAME
Password: PASSWORD
230 User USERNAME logged in
ftp> binary
200 Type set to I
ftp> cd httpdocs/myfiles
250 CWD command successful
ftp> lcd F:\Test\Folder1
Local directory now F:\Test\Folder1
ftp> mkdir MyTest1
257 "/httpdocs/myfiles/MyTest1" - Directory successfully created
ftp> put test.bmp

Freeze connection and router

share|improve this question
    
Which router you have? –  week Dec 5 '12 at 1:58
    
Have you tried anything to debug this? Try adding dir after the cd. Try replacing the mput *.bmp with put foo.bmp. And — am I missing something? Are you FTPing into a router, or into some ordinary computer? It might help if you told us what your FTP server is. (And have you tried hitting Ctrl+C when your connection freezes?) (Also, can you sniff the network traffic?) –  Scott Dec 5 '12 at 16:18
    
@Scott I've edited my question and added replies to all your questions at the footer of my question Regarding sniff of network traffic, I am sorry but I am not that experienced to know how to sniff network traffic :) –  MChan Dec 5 '12 at 17:53
    
@Scott I've copied and pasted the output of the commands at the end of my question –  MChan Dec 5 '12 at 19:12
    

2 Answers 2

After

lcd F:\Test\Folder1

try

lcd F:\Test\Folder1
mkdir MyTest

Check that MyTest was created properly. I suspect that your router can't find the directory but isn't throwing an error. When the transfer begins is when it is caught.

I don't see anything wrong with

mput *.bmp
share|improve this answer
    
I've just tried mkdir it worked just fine, but mput didn't work :( I've also copied and pasted the commands output log in my original question above. –  MChan Dec 5 '12 at 19:12

OK, the problem isn’t specifically in the MPUT command.  Unless you are able to get some FTPs to work, I’m going to go out on a limb and guess that your problem is the same as in the previous questions on this subject — something in the network path between the two machines (including the router and the hosts themselves) is blocking TCP port 20.  (FTP uses two port numbers: 21 for control information and 20 for data.  Clearly port 21 is getting through.)  If FTP was working until recently, see whether something changed: did a sysadmin tighten some firewall rules?

share|improve this answer
    
No actually I don't have any firewall installed on the client machine which i use to connect to the FTP server, and even Firewall is disabled –  MChan Dec 6 '12 at 0:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.