Friday, October 12, 2007

Batch Scripting ftp in windows xp

I'm a luddite. For the past decade to move files to my hosted computer I've used manual ftp command lines or mounting a directory in network places and dragging the files over to the website. Tonight I broke down, took 10 minutes to research on the web, and now can batch ftp the files with a button. No more dragging directories of files from one pane to another. And its quite easy. My script file, ftp.scr:

open mydomain.com

user myuserid
mypassword
cd www
cd news
cd 2007
lcd c:\home\mfincher\images\new
bin
prompt
mput *.JPG
lcd originals
cd originals
mput *.JPG
quit

The directions at microsoft's site don't quite work with dreamhost. The secret is to let the ftp session error out on the username/password and then reenter them in the script.
To run the script: ftp -s:ftp.scr

No comments: