Automating FTP II: Windows
Having thought about automating command line FTP on UNIX/Linux, the same idea came to me for Windows too and you can achieve much the same results, even if the way of getting there is slightly different. The first route to consider is running a script file with the ftp command at the command prompt (you may need %windir%\system32\ftp.exe to call the right FTP program in some cases):
ftp -s:script.txt
The contents of script are something like the following:
open ftp.server.host
user
password
lcd destination_directory
cd source_directory
prompt
get filename
bye
It doesn’t take much to turn your script into a batch file that takes the user name as its first input and your password as its second for sake of enhanced security and deletes any record thereof for the same reason:
echo open ftp.server.host > script.txt
echo %1 >> script.txt
echo %2 >> script.txt
echo cd htdocs >> script.txt
echo prompt >> script.txt
echo mget * >> script.txt
echo bye >> script.txt
%windir%\system32\ftp.exe -s:script.txt
del script.txt
The feel of the Windows command line (in Windows 2000, it feels very primitive but Windows XP is better and there’s PowerShell now too) can leave a lot to be desired by someone accustomed to its UNIX/Linux counterpart but there’s still a lot of tweaking that you can do to the above, given a bit of knowledge of the Windows batch scripting language. Any escape from a total dependence on pointing and clicking can only be an advance.
Place your comment
Topics Discussed
Adobe Apache Blogging Blogs Canon Command Line CSS Debian Fedora Firefox GNOME Google Hard Drives Hardware HTML Installation Internet Explorer Linux Microsoft MySQL Opera Operating System Perl Photoshop Photoshop Elements PHP Plugins SAS Software SQL Ubuntu UNIX upgrade VirtualBox Virtualisation Virtual Machines VMware Web Browsers Windows Windows Vista Windows XP WordPress WordPress.com WordPress plugins XHTMLTwitter Updates
- GR Shared Items: Install Guest-Additions on Ubuntu 10.10 Beta : Workaround http://ow.ly/18VGtM 3 hrs ago
- GR Shared Items: Donncha: Easy Setup for WP Super Cache - One of the things that has bugged me about the WP Super Ca... http://ow.ly/18UbjE 1 day ago
- GR Shared Items: SD, SDHC and SDXC cards get speed injection http://ow.ly/18UbjF 1 day ago
- GR Shared Items: WP Blackberry: WordPress for BlackBerry 1.4.3 Released http://ow.ly/18UbjG 1 day ago
- Not before time: RT @pc_pro: Orange and T-Mobile to share networks from next month http://bit.ly/bhdXsu (Ah, bless) 3 days ago
- More updates...
Monthly Archives