Speed up FTP file transfer using SSH and compressing in TAR GZ
Two days ago I needed to transfer in local a massive expressionengine templates, so this mean I had to move hundreds of files.
Of course I can open Filezilla and let it work for me, but the time to complete this operation would be long.
So my choice has been: first I compress the folder with all the files using the command line, and then I download the compressed file, saving in total more than twenty minutes.
Because I work in a Windows environment, my choice for SSH connections is “KiTTY“, an open source project born from PuTTY’s ashes.
Connect to the server via SSH
Once KiTTY has been downloaded, we open it and fill up the field “Host Name” and click
Fist we have to put the address of our remote host. We should get those information from our hosting provider, and then click “Open” Please note: not each hosting provider allow to access through SSH.
Once the connection starts we have to put our username and password, usually those parameters are the same we use to connect with the ftp.
While we digit the password, looks like if nothing happen: no worries is a security feature of all UNIX system: if someone is behind us he can’t check our password length, unless he hear the pressure of the buttons.
Make the compressed file from the terminal
Once we are logged in through our SSH client, we can type the command to compress the folder we are interested in:
tar -zcvf /path/to/the/compressed/file/name-of-the-archive.tar.gz /path/to/the/directory/
Where the parameters means:
- -z: Compress archive using gzip program
- -c: Create archive
- -v: Verbose (this mean that the progress is displayed on the terminal)
- -f: Archive File name.
Once the operation is complete, we can open our FTP client and proceed with the download of the file.
If we have a huge number of files this procedure’ll save us a bunch of time.
If you find this article helpful, please leave a comment, thanks!