FTP Command line tips
I. Opening and closing connection
* ftp - starts an FTP session
* open hostname - connects to the specified host
* close - closes the connection (but not the FTP session!)
* quit - terminates the FTP session
II. 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
III. Directories in FTP
* pwd - prints the name of the current remote directory
* cd remote-directory - changes working directory on remote host
* cd .. - moves up one level in the directory structure on the remote host
* lcd directory - changes the default directory on local host
IV. 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:
o SPSS System files
o SAS Transport files
o Stata Datasets
o Graphics files (e.g., *.gif, *.jpg, *.bmp, etc.)
o 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:
o Raw Data (e.g. *.dat or *.txt, codebooks, or other plain text documents)
o SPSS Portable files
o HTML files
V. 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.
VI. Other Commands
* get test "| more" - displays file "test"
To make sure you want a document, you can display it with the more command and see the file screen by screen (using the space bar) BEFORE you get a file. To exit out of more , type q.
* prompt - turns off prompting for individual files when using the mget or mput commands.
* If you have mistyped your username or password, use the user command to re-login.
* For a list of all FTP commands type ? at the ftp> prompt.
* For a brief explanation of a command, type help, leave a space,and type the command itself.
0 Comments:
Post a Comment
<< Home