Solved

FTP upload in one batch file

Posted on 2007-04-11
4
8,376 Views
Last Modified: 2008-01-09
HI,
i'd like to do a simple upload script in one file. I know from PAQ i can do in 2 files:

upload.bat...
ftp -s:ftpscript.txt

ftpscript.txt...
open servername
user
password
cd website/foto
etc...

How can i put ftpscript.txt directly into upload.bat?

Also, any way to hide the password and enter using a prompt?

Thanks!

0
Comment
Question by:xenium
  • 2
4 Comments
 
LVL 95

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 60 total points
ID: 18888970
No way to hide the password I've ever seen (trying it a bit silly, given that it's transmitted in clear text anyway).

You can have the batch file create the ftpscript -

@echo off
echo open servername>ftpscript.txt
echo username>>ftpscript.txt
echo password>>ftpscript.txt
echo cd website/foto>>ftpscript.txt
echo etc...>>ftpscript.txt
ftp -s:ftpscript.txt
0
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 65 total points
ID: 18888983
Hi,

Create the text file from the batch file. For example:

@echo off
echo open servername > ftpscript.txt
echo user >> ftpscript.txt
echo password >> ftpscript.txt
echo cd website/foto >> ftpscript.txt
etc... complete your commands this way.
ftp -s:ftpscript.txt
del ftpscript.txt


If you want the password to be prompted for, then leave it out of the text file. It will sit there and wait for the password when prompted. I don't know of a simple way in batch language to hide the password.


Regards,

Lee

0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 18888989
Nice one leew. I was just typing the same out as you posted!

Regards,

Lee
0
 

Author Comment

by:xenium
ID: 18890098
hmm, ok, that would work. Was hoping there'd be a neater solution, to just pipe the remaining commands from within the file. Thanks for the tips though.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question