|Developer Tools||Office Productivity Applications
Gnostice Document Studio
Tuesday, October 06, 2015
Microsoft has bundled an command-line FTP program, humbly named "ftp", with every version of Windows released to date. It can be used interactively and can also be run off a script. When you type
ftp in the command line, the command starts its own Unix-style prompt against which you run your FTP commands.
To connect to a site, you type
and to upload a file you type
put filename.ext. Or, you could use FileZilla! Yes, even that can be a hassle if you need to do it repeatedly or if you need to make this upload part of a workflow process.
ftp provides a scripting interface. Put all the commands in a file and run the command with
-s parameter. (For some reason, the
-s parameter does not work in CAPS.)
To navigate directories on the remote server, you use the
cd command. To do the same in the local system, you use the
lcd. You can also prefix exclamation (
!) character to any DOS command to run it on the FTP server.
To delete multiple files in the current directory, use the
mdelete and to upload multiple files from the local directory, use
put works for individual files. Use the binary files, as otherwise the upload may choose ASCII. Use prompt to turn off interactive prompting.
open ftp.example.com username password cd httpdocs/some_path binary debug prompt mdelete *.* mput *.* quit
In Linux, I use a slightly different script.
ftp -i -v -n $HOST <<CODEBLOCK
quote USER $USER
quote PASS $PWD
FTP command - https://technet.microsoft.com/en-us/library/bb490910.aspx
FTP subcommands - https://technet.microsoft.com/en-us/library/bb490911.aspx
|Privacy | Legal | Feedback | Newsletter | Blog | Resellers||© 2002-2019 Gnostice Information Technologies Private Limited. All rights reserved.|