How to Update Your Site With a Batch File
A batch file is not an FTP program. Batch files are lists of command line instructions that are batched together in one file.
As soon as a batch file initiates an FTP connection, your computer is running in that shell and no longer working out of the batch file. So the way to do it is to include another file into the batch file that contains all of your FTP commands. Then once this script is completed you're back to the batch file to complete any other tasks contained within it.
Sound confusing? It will be easier to explain by showing you the files:
So, here is the contents of my batch file called "2bat.bat"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO OFF
FTP -s:login.txt your_domain.com
CSL
EXIT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when this batch file is run it calls the login.txt which contains
my username, password, and other FTP commands. Here is the
contents of login.txt:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
username
password
cd www
put myfile.html
bye
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This would apply to private websites like mine where a username and password is required and not to FTP servers that allow an automatic login.
If you're connected to the Internet using DSL/Cable and your
computer is on all of the time like mine, this makes it very easy to update your website while away from your computer. All you would do is set "2bat.bat" in Windows scheduler to run at your chosen time.
If you use a dial-up connection you would have to have other commands in your batch file.
| Back to Article Index |
Copyright © All Rights Reserved. The information/images on this website
may not be reproduced or republished by anyone without permission.