DEV Community

Cover image for Easy File Transfer Guide From Local to Remote
Yulin
Yulin

Posted on • Updated on

Easy File Transfer Guide From Local to Remote

To follow this tutorial, you will need FileZilla installed on your local computer, make sure you're downloading the client. Once you've been granted access to the server, you will need an FTP client to upload or download files, here we're using FileZilla.

For a large file, you will need to create a tarball. An overview of the process is to make a tarball that contains your source code, transfer the tarball to remote server using FileZilla GUI. SSH login into the remote server and undo the tarball to view your source code. Vice versa to transfer files from remote to local.

Quick FileZilla Tutorial

When you open the software, you will see these fields at the top
Screenshot of the FileZilla login section

Let's say you've been given the login details

and you're accessing the server by SSH
ssh -p 0022 name@domain.com

Your connection details on FileZilla will be

Protocol: SFTP (SSH File Transfer Protocol)
Address/Hostname: domain.com
Port: 0022 (or leave blank if VPN connected)
username: name
password: password

The Host field is the protocol and hostname combined:

sftp://domain.com

FileZilla Example Login

The FileZilla interface is split in two halves.

Once you're logged in, you will see your local files on the left panel and the remote files on the right hand side panel.

To upload and download from one side to the other, you just need to double click, or right click on the file.

Step By Step Guide

1.Make a tarball of source

cd to where your source code project folder is located, and run the command

tar -czvf project.tar.gz project
Enter fullscreen mode Exit fullscreen mode

This will create a compressed gzip archive file project.tar.gz for the directory project in the current working directory.

If you're compressing a Github repository you might want to exclude some irrelevant files

tar --exclude=.git \
    --exclude=.gitignore \
    -czvf project.tar.gz project
Enter fullscreen mode Exit fullscreen mode

The tar command options used:
c, creates a new .tar archive file
z, creates a gzip archive file
v, verbosely show the .tar file progress
f, file name type of the archive file

2.Open FileZilla
Follow the steps in the tutorial to login, drag and drop project.tar.gz from one side to the other to complete the file transfer.

3.Undo the tarball at destination
Now you've transferred the zipped archive, and you want to recover the source code:

tar -xvf project.tar.gz
Enter fullscreen mode Exit fullscreen mode

This command uncompresses and extracts the tarball in the current directory. If you'd like to untar in a different directory, run

tar -xvf project.tar.gz -C /home/destination
Enter fullscreen mode Exit fullscreen mode

That's it :)

A side note on downloading, recommended to tar and download the entire folder which makes editing a lot easier.

Cover Image taken from IpSwitch

Top comments (0)