Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FTP upload in one batch file

Posted on 2007-04-11
4
Medium Priority
?
8,385 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 180 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 195 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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