Change to the source directory on the local system.
The directory from which you type the ftp command is the local working directory, and thus the source directory for this operation.
Establish an ftp connection.
Change to the target directory.
ftp> cd target-directory |
Remember, if your system is using the automounter, the home directory of the remote system's user appears parallel to yours, under /home.
Ensure that you have write permission to the target directory.
ftp> ls -l target-directory |
Set the transfer type to binary.
ftp> binary |
To copy a single file, use the put command.
ftp> put filename |
To copy multiple files at once, use the mput command.
ftp> mput filename [filename ...] |
You can supply a series of individual file names and you can use wildcard characters. The mput command copies each file individually, asking you for confirmation each time.
To close the ftp connection, type bye.
ftp> bye |
In this example, the user kryten opens an ftp connection to the system pluto, and uses the put command to copy a file from his or her system to the /tmp directory on system pluto.
$ cd /tmp ftp pluto Connected to pluto. 220 pluto FTP server (SunOS 5.8) ready. Name (pluto:kryten): kryten 331 Password required for kryten. Password: xxx 230 User kryten logged in. ftp> cd /tmp 250 CWD command successful. ftp> put filef 200 PORT command successful. 150 ASCII data connection for filef (129.152.221.238,34356). 226 Transfer complete. ftp> ls 200 PORT command successful. 150 ASCII data connection for /bin/ls (129.152.221.238,34357) (0 bytes). dtdbcache_:0 filea filef files ps_data speckeysd.lock 226 ASCII Transfer complete. 60 bytes received in 0.058 seconds (1.01 Kbytes/s) ftp> bye 221 Goodbye. |
In this example, the same user kryten uses the mput command to copy a set of files from his or her home directory to pluto's /tmp directory. Note that kryten can accept or reject individual files in the set.
$ cd $HOME/testdir $ ls test1 test2 test3 $ ftp pluto Connected to pluto. 220 pluto FTP server (SunOS 5.8) ready. Name (pluto:kryten): kryten 331 Password required for kryten. Password: xxx 230 User kryten logged in. ftp> cd /tmp 250 CWD command successful. ftp> mput test* mput test1? y 200 PORT command successful. 150 ASCII data connection for test1 (129.152.221.238,34365). 226 Transfer complete. mput test2? y 200 PORT command successful. 150 ASCII data connection for test2 (129.152.221.238,34366). 226 Transfer complete. mput test3? y 200 PORT command successful. 150 ASCII data connection for filef (129.152.221.238,34356). 226 Transfer complete. ftp> bye 221 Goodbye. |