Solved

FTP upload in one batch file

Posted on 2007-04-11
4
8,369 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
Comment Utility
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
Comment Utility
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
Comment Utility
Nice one leew. I was just typing the same out as you posted!

Regards,

Lee
0
 

Author Comment

by:xenium
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

17 Experts available now in Live!

Get 1:1 Help Now