Archive for June 16, 2007

Automating FTP on the cheap   Leave a comment

All windows 2000 and above computers come with quite a decent selection of tools for automating processes. It is quite trivial for example to backup or copy date to a remote computer using ftp with the exisitng command line tools. By writing your ftp commands to a file and reading this using ftp you can remove the need for human intervention completely.

An example script follows,

Upload file,

@echo off
echo open server > %TEMP%\ftpscript
echo user username password >> %TEMP%\ftpscript
echo bin >> %TEMP%\ftpscript
echo put test1_binary.zip >> %TEMP%\ftpscript
echo put test2_binary.zip >> %TEMP%\ftpscript
echo put test3_binary.zip >> %TEMP%\ftpscript
echo put stock_check.zip >> %TEMP%\ftpscript
echo bye >> %TEMP%\ftpscript
echo. >> %TEMP%\ftpscript
ftp -n -i < %TEMP%\ftpscript

This is a very simple script that creates the script it uses on the fly. Use the scheduler (accessable via the computer settings option) to add the script to it and you have an automated file copy.

Note: one of the things you need to be careful about is who has permission to the scripts and temp files. The script must have the username and password in it.

Posted June 16, 2007 by colinnewell in Configuration

Follow

Get every new post delivered to your Inbox.

Join 32 other followers