pf » FTP Scripts on windows
FTP Scripts on windows
I found this Microsoft KB article today 96269 which shows you how to use the ftp program that comes with all versions of windows an automate a file transfer.
ftp -s:script.txt ftp.server.comThe contents of script.txt might look like this:
yourUserName yourPassword bin cd /files put file.zip byeThis is handy for administration between servers, but keep in mind that FTP sends passwords in clear text.
Related Entries
- xcopy - Handy tool on windows - December 9, 2003
- Uptime for Windows 2000, 2003, XP and NT - October 13, 2002
- SSH for Windows - December 6, 2004
- Unix Utils for Windows - November 9, 2004
- Right Click to Open Command Prompt in Directory - July 22, 2004
------------------------------ c:\>run.bat <FILE_NAME>
run.bat will have
ftp -n -s conn.bat
conn.bat will have
open 128.120.2.1 user guest guest lcd c:\ cd $DATA mput <FILE_NAME> bye
--------------------------------------- Hw do i go abt this?
Thanks in adv
Pls reply to a.prashanth@gmail.com
Prashanth
Harsha
Use WinSCP instead kiddies.
Thanks,
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A]" Yadiyadiya, it's the default command line help that pops up.
I'm so close to get my script working but can't find the solution for this last step.
Can you help me?
Which result in this script.txt: yourServerName yourPort# yourUserName yourPassword bin cd /files put file.zip bye
The ftp session can be started like this: ftp -s:script.txt
My problem is when the built in windows FTP client tries to download a file from the ftp server using the get command, if the file does not exist on the server, it wipes out the file that is locally on my C: drive and leaves me with a blank file.
I must always keep the field headers in this file and as such I must make sure that if there is no file on the server to leave the one locally alone.
How can this be done?
(Is there a way to first look to see if the file exist and only then initiate the download?)
Need help - - - - - - Thanks!
Thank you!
maeven
do c:\windows\system32\ftp -s:script.txt ftp.server.com
Thanks.
ECHO OFF REM batch file to ftp a nominated file to a fixed host and directory REM This is so much easier to do in Unix...
REM Validate the input IF %1=="" GOTO error
REM write the script file for use by ftp SET scriptFileName=ftpScript.txt
ECHO open host >> %scriptFileName% ECHO user >> %scriptFileName% ECHO userName >> %scriptFileName% ECHO password >> %scriptFileName% ECHO ascii >> %scriptFileName% ECHO cd deployDirectory >> %scriptFileName% ECHO put %1 >> %scriptFileName% ECHO bye >> %scriptFileName%
REM now use the file. ftp -n -s:%scriptFileName%
REM now clean up the file del %scriptFileName%
ECHO FTP completed GOTO end
:error ECHO ftpFile. Sends a given a file to a nominated host ECHO usage ftpfile <fileToFTP> GOTO end
:end
the skript should login, change dir, delete files in there and upload the new ones.
i don't want to use mput * y y in the .txt as the files to be deleted may vary
any hints ?
yourUserName yourPassword bin cd /files put file.zip bye
How can i hidden the password and userid in script.txt file ?
thank you so much.
- CFSCRIPT Cheatsheet
- 3 New Image Effects for ColdFusion 8
- Googlebot to Submit Web Forms
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks
- 10 Most Useful Image Functions in ColdFusion 8
- Speaking at NYC CFUG This Week
- Adobe AIR Tutorial for HTML / JavaScript Developers
- INFORMATION_SCHEMA Support in MySQL, PostgreSQL
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in










