Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jul 19, 2005 3:40 am Post subject: Self-contained script for FTP uploading |
|
|
Here is a simple script to automate FTP uploading, downloading, and other actions. I think something like this has been posted before, but this one uses a continuation section to make it easier to visualize and maintain the commands.
| Code: | ; The following example demonstrates how to automate FTP uploading using the
; OS's built-in FTP command. This script has been tested on Windows XP and 98se.
FTPCommandFile = %A_ScriptDir%\FTPCommands.txt
FTPLogFile = %A_ScriptDir%\FTPLog.txt
FileDelete %FTPCommandFile% ; In case previous run was terminated prematurely.
FileAppend,
(
open host.domain.com
username
password
binary
cd htdocs
put %VarContainingNameOfTargetFile%
delete SomeOtherFile.htm
rename OldFileName.htm NewFileName.htm
ls -l
quit
), %FTPCommandFile%
RunWait %comspec% /c "ftp.exe" -s:"%FTPCommandFile%" >"%FTPLogFile%"
FileDelete %FTPCommandFile% ; Delete for security reasons.
Run %FTPLogFile% ; Display the log for review. |
|
|