How to Write CMD Line FTP Scripts
FTP, which stands for File Transfer Protocol, is a way to rapidly transfer files on the Web. While the HyperText Transfer Protocol (or HTTP) is the protocol browsers use to look up web pages, the FTP is what website owners typically use to upload or download files to and from their servers. There are two ways to utilize it: through a graphical FTP client, which provides a user interface for transferring your files, and through a command prompt, writing FTP commands by hand.
Instructions
-
Steps
-
1
Press the Windows logo button on your keyboard, and while you're holding it down, press the "R" key. The "Run" dialog box will appear. Type "cmd.exe" (without quotes) and press Enter. If you're using a Mac, open your hard drive, then "Applications," then "Utilities," and then "Terminal."
-
2
Go to the directory you wish to upload or download files to using the "cd" command. For example, if you want to use the main Windows folder, you would type "cd c:\windows" and press enter.
-
-
3
Connect to your server by typing "ftp ftp.yoursite.com" and pressing Enter. The program will prompt you for your username and password.
-
4
Use the "get" command to download files from your server. By default, you're already connected to the root directory. So if you have a file called "file.html" in a subdirectory called "folder", you would grab it by typing "get /folder/file.html" and pressing Enter.
-
5
Use the "send" command to send local files on your computer to the server. You can use the "cd" command again in conjunction with "send" to send your files to particular directories on the server. For example, say you wanted to upload "anotherfile.html" to the "folder" subdirectory. First, you type in "cd /folder" and press Enter. A message will appear verifying that "/folder" is now the current directory. Then, you would type "send anotherfile.html" and press Enter again. You'll get a "successfully transferred" message and the file will now appear in the "folder" subdirectory on the remote server.
-
6
Type "bye" and press Enter to end the session, then "exit" to close the command prompt.
-
7
Learn the many other FTP scripts at your disposal for even more control (see Resources below).
-
1