Solved

FTP upload in one batch file

Posted on 2007-04-11
4
8,372 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now