Lots of people come to ask me how to send and receive files through FTP using the command window. Even this is a simple task I´ll show the way to do that and some examples.
Open your prompt and type
ftp ip_address (or the dns_address)
If it´s a secure ftp connection, you´ll be prompted to insert the username and the password.
When you are logged in you should see the FTP prompt like this “ftp>“.
Now follows a list of commands to use within FTP:
1. Opening and closing connection
- ftp - starts an FTP session
- open hostname - connects to the specified host
- close - closes only the connection
- quit - terminates the FTP session
2. Browsing on a remote machine
- dir - gives a full directory listing on the remote machine
- dir test* - displays only files and directories whose name begins with “test…”
- ls - same as dir, but provides a simplified listing of filenames
3. Directories in FTP
- pwd - prints the name of the current remote directory
- cd remote-directory – changes working directory on remote host
- lcd directory – changes the default directory on local host
4. Types of files
- binary - type this command at the FTP prompt to set binary mode before transferring binary files
- For example, use binary mode with the following types of files:
- SPSS System files
- SAS Transport files
- Stata Datasets
- Graphics files (e.g., *.gif, *.jpg, *.bmp, etc.)
- Microsoft Office documents (*.doc, *.xls, etc.)
- ascii - type this command at the FTP prompt to set ASCII mode before transferring text files.
- Use the ASCII mode with any of the following:
- Raw Data (e.g. *.dat or *.txt, codebooks, or other plain text documents)
- SPSS Portable files
- HTML files
5. Transferring files
- get test - copies file “test” from remote to local host (from current remote directory to current local directory)
- mget test.* data.dbf - copies files beginning with “test” and the file named data.dbf from remote to local host
- put test - copies file “test” from local to remote host.You musth have write access to the remove host for this to work.
- mput test.* data.dbf - copies files beginning with “test” and the file named data.dbf from local to remote host
- quit - closes connection and terminates FTP session
- If a file name contains spaces (e.g. on your Windows system) you should type the file name in quotation marks ” “,
but it is strongly recommended to rename such files before FTPing them.
Like this:
Be the first to like this post.