Solved

FTP upload in one batch file

Posted on 2007-04-11
4
8,380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 96

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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