Easy File Transfer Guide From Local to Remote
Tags: webdev, beginners, programming, tutorial
Published: 2022-02-17 19:11:24

To follow this tutorial, you will need [FileZilla](https://filezilla-project.org/) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5v13ioj0yqdl1kva0sc.png)
 
Let's say you've been given the login details
- username: name@domain.com
- password: password

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9jspsahpy5d0zqvhpwy.png) 

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
```
  
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
```

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
```
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
```

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](https://www.ipswitch.com/blog/what-is-file-transfer-protocol-ftp)