[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

mput not working

Hi,

I am trying to upload multiple files.  Here is my batch file;

@echo off
REM Set filename for temporary file in temp directory and delete any previous one.
set ftpfile=%temp%ftpscript.txt
if exist %ftpfile% del %ftpfile%

REM Write temporary FTP script to above file
REM Make sure no space between username and password and the redirection more than sign
echo open IP>> %ftpfile%
echo user>>%ftpfile%
echo pass>>%ftpfile%
echo mput *.vap /y>>%ftpfile%

REM Execute FTP using script then delete it
ftp -s:%ftpfile%
del %ftpfile%

REM Execute FTP using script then delete it
ftp -s:%ftpfile%
del %ftpfile%

The script works up until the mput part.

It shows file not found.  I run the script from the same directory as my .vap data files, so that should be the local directory upon ftp'ing.

Please help

0
nickmarshall
Asked:
nickmarshall
  • 6
  • 5
1 Solution
 
Richard QuadlingSenior Software DeverloperCommented:
Hi nickmarshall,


When you connect to the ftp site, are you in the correct location to receive files?

Add an lcd command.

Say the files are in C:\MyFilesForUploading

then before the echo mput line add ...

echo lcd C:\MyFilesForUploading>>%ftpfile%

Does that make a difference?

Regards,

Richard Quadling.
0
 
nickmarshallAuthor Commented:
Hi,

Yes, I tried this however it still shows "file not found" after displaying all of the current localfiles when the mput command is executed.

Very strange?
0
 
Richard QuadlingSenior Software DeverloperCommented:
Ha ha!

Have you checked the FTP site?

You have ...

REM Execute FTP using script then delete it
ftp -s:%ftpfile%
del %ftpfile%

REM Execute FTP using script then delete it
ftp -s:%ftpfile%
del %ftpfile%

twice.

The file not found is PROBABLY the %ftpfile%


0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
nickmarshallAuthor Commented:
Sorry, but that still shows the same thing.

I have checked the remote site too and it is not uploading the files.
0
 
Richard QuadlingSenior Software DeverloperCommented:
Can you repost the current .bat file AND the ftpfile it creates. Remove any security data obviously.
0
 
nickmarshallAuthor Commented:
@echo off
set ftpfile=%temp%ftpscript.txt
if exist %ftpfile% del %ftpfile%

echo open ip>> %ftpfile%
echo user>>%ftpfile%
echo pass>>%ftpfile%
echo lcd C:\windows\audit>>%ftpfile%
echo mput *.vap /y>>%ftpfile%

ftp -s:%ftpfile%
del %ftpfile%
0
 
Richard QuadlingSenior Software DeverloperCommented:
Hmmm.

You have to supply a user and a password.

I would also use ftp -i -n -s:%ftpfile%

-n Suppresses auto-login upon initial connection.

-i Turns off interactive prompting during multiple file transfers.

Is IP the name of the site? or a env variable? Or are yu substituting that for a real IP address?
0
 
nickmarshallAuthor Commented:
Here is the script which appears to work now...

@echo off
REM Set filename for temporary file in temp directory and delete any previous one.
set ftpfile=%temp%ftpscript.txt
if exist %ftpfile% del %ftpfile%

REM Write temporary FTP script to above file
REM Make sure no space between username and password and the redirection more than sign
echo open IP>> %ftpfile%
echo user user>>%ftpfile%
echo password>>%ftpfile%
echo lcd C:\windows\audit>>%ftpfile%
echo mput *.vap /y>>%ftpfile%
echo quit>>%ftpfile%

REM Execute FTP using script then delete it
ftp -i -n -s:%ftpfile%
del %ftpfile%

The script uploads everything now, sp thanks for that....

It stops after the upload with the text;

"operning data channel for transfer"

I have echoe'd quit, however it doesnt seem to be quitting out.

0
 
Richard QuadlingSenior Software DeverloperCommented:
And if you use ftp -i -n and then manually type the commands, does it work?
0
 
nickmarshallAuthor Commented:
Hi,

When I manually type the commands it ends with "Netout: Connection reset by peer"

?
0
 
Richard QuadlingSenior Software DeverloperCommented:
Hmmm.

Do you get ANY transfer? Do you have a firewall you can watch the activity?

Try using Ethereal to watch the packets. Could be a LONG wait though, BIG log file!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now