Bootstrap FreeKB - FTP and Secure FTP (FTPS, SFTP) - download a file or directory using the get command
FTP and Secure FTP (FTPS, SFTP) - download a file or directory using the get command


There are a number of ways to securely transfer files between systems.

  • The PSFTP command line tool can be used to for SFTP (Secure FTP) to securetly transfer files between systems, from a remote system to your PC, or vice versa. This has the advantage of being able to transfer files between Linux, Mac and Windows systems.
  • The scp command (Secure Copy Protocol) could be used to securely transfer files between Linux systems.

There are a number of different tools that can be used to connect to an FTP / FTPS / SFTP server.

  • Windows or Linux command line prompt
  • Scripting tool (e.g. Bash, Perl, PowerShell, Python, et cetera)
  • The PSFTP command line tool PSFTP.exe (see Installing PuTTY PSFTP)

Use the lpwd (local present working directory) command to determine your current working directory on your local PC (not on the remote FTP system).

ftp> lpwd
Current local directory is C:\Program Files (x86)\PuTTY

 

If you need to change your local working directory, use the lcd (local change directory) command to move into the C:\Users\john.doe directory on your local PC (not on the remote FTP system).

ftp> lcd C:\Users\john.doe
New local directory is C:\Users\john.doe

 

Use the pwd (remote present working directory) command to determine your current working directory on the remote FTP system (not on your local PC).

ftp> pwd
Remote directory is /home/john.doe

 

If you need to change the working directory on the remote FTP system, use the cd (change directory) command.

ftp> cd /tmp
Remote directory is now /tmp

 

Use the get command to transfer the file from the remote system to your present working directory (pwd) on your local PC.

ftp > get foo.txt
local: foo.txt => remote:/tmp/foo.txt

 

Optionally, you can choose a different name for the file. In this example, the foo.txt would be named bar.txt on your local PC.

ftp > get foo.txt bar.txt
local: foo.txt => remote:/tmp/bar.txt

 

Likewise, the get command can be used to transfer a directory and the contents of the directory, optionally giving the directory a different name. In this example, the "/tmp/foo" directory is transferred from the remote system and renamed to "bar".

ftp > get -r foo bar

 

Use the exit command to disconnect.

ftp > exit

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d7cc20 in the box below so that we can be sure you are a human.