# Transferring Files

Transferring files onto and off of your Lawrence home directory can be done using several methods available to researchers at USD. This section will cover the movement of files between local systems and the Lawrence HPC.

{% hint style="info" %}
Note: For **very large files**, please see the CyberDuck section below, and use a desktop or computer with a wired internet connection (not wifi) if possible.
{% endhint %}

## Drag-and-Drop Option

If you prefer to move files using the drag-and-drop method, it is possible using MobaXterm or Cyberduck. This file moving method uses sftp, or SSH (or Secure) File Transfer Protocol. For this we will open up MobaXterm or Cyberduck.

{% hint style="info" %}
For help downloading MobaXterm, click [here](https://usdrcg.gitbook.io/docs/~/edit/drafts/-LUGvCyCLVx1LFQp3u6h/software-and-apps/lumerical-fdtd-on-lawrence-gui#install-mobaxterm).
{% endhint %}

### **MobaXterm**

In MobaXterm, the file explorer/hierarchy is visible just to the left of the command line interface.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LP2YuRfraQjMGu4EC3x%2F-LP2lyfCuG46dyHEdyE1%2FScreenshot%20\(10\).png?alt=media\&token=f332310d-1384-44c3-94b8-fed84fe5f836)

From this section of the MobaXterm window, you can drag and drop files between either computer as you desire.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LPatH8qBDqxS5oN7YZQ%2F-LPavGL1-BMDWPmTP8eG%2FmobaxMovingFile.png?alt=media\&token=f9aff36c-4c08-4e8f-be7a-0e9bcf0260ce)

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LOTYI8JBMO1-PfD6hLD%2F-LOU8kVxA06aDzRIZidX%2FScreenshot%20\(8\).png?alt=media\&token=d0eb309e-2b3d-400c-bd91-fa91e62fbc3a)

### **Cyberduck**

Cyberduck can also be used for moving files by sftp in Windows and Mac, but not Linux. You can find the Cyberduck installation [here](https://cyberduck.io/). Once installed, opening Cyberduck should return a window as follows:

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LPBxBOsXjbX9v1Oo8oS%2F-LPBxRPBHGwzKFE6WcBD%2Fimage.png?alt=media\&token=ebcf3642-b140-48ca-91ab-c0d80d63cf99)

You will need to open a connection by clicking on the 'Open Connection' icon. This will return a window to fill in with the host information. Fill this window in as shown below (note user.name will be your personal Lawrence username). Be sure to choose SFTP and port 22:

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LMz81hGuxaF-zEn1Xlj%2F-LMz83y_LTP3LmEN_iJQ%2Fcyberduck_2?generation=1537583903043299\&alt=media)

After successfully connecting, you can upload files into your Lawrence folders on your home directory by dragging and dropping from your desktop...&#x20;

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LPatH8qBDqxS5oN7YZQ%2F-LPawMaO2jlkfUi5Hlu_%2FCyberduckMoveFile.png?alt=media\&token=29de5508-42b5-4c3b-9ae4-bd179a7faa28)

or by clicking the upload icon at the top of the Cyberduck display.

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LOUDzsaKPkR0XGctlSo%2F-LOUE3EIxT-WTjueuZ4p%2FScreenshot%20\(19\).png?alt=media\&token=86959e6c-f87c-44f1-8943-11428a03161c)

![](https://57295520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMxcW8l8a9ogs7-hqgF%2F-LOUDzsaKPkR0XGctlSo%2F-LOUEuNu3XEK7OPKxEAR%2FScreenshot%20\(21\).png?alt=media\&token=280d80d6-c46d-4061-9e77-c360c826c034)

## Command Line SCP

The standard command line method for file movement between hosts is the `scp`command (secure copy). This is an ssh based protocol designed for moving files between local and remote hosts. To get files from your local computer, you will need to open a local terminal session on your computer (Do not connect to the HPC! In this example, local@xyz is my local PC).

```
[local@xyz ~]$
```

The syntax of the `scp` command has three parts:&#x20;

1. scp command
2. current path to file to be moved
3. target path where the file will be sent

Type the `scp` command as follows (type the path you want your file transferred to on Lawrence; here I use ''some.folder'):

```
[local@xyz ~]$ scp  ./pathTo/file/file.name User.Name@Lawrence.usd.edu:/home/usd.local/user.name/some.folder
user.name@lawrence.usd.edu's password: 
file.name              100% 8893     8.7KB/s   00:00
```

Hints:

* If you are logging into Lawrence as a user from another school (not USD), "usd.local" may be replaced by an identifier for your school: (e.g. user.name@lawrence.usd.edu:/home/**blackhills.local**/user.name/some.folder)
* Don't forget either the period (.) at the start of the initial path to the file (it refers to the current working directory (the directory you are located in)) or a complete path to the file (/home/Desktop/pathTo/file/file.name)
* Don't forget the colon (:) after ".edu"
* To transfer directories, add an -r flag

```
[user.name@login@login some.folder]$ scp -r ./pathTo/and/including/myDirectory/ User.Name@Lawrence.usd.edu:/home/usd.local/user.name/
contents.c                                      100%  1KB    45KB/s    00:00
of.c                                            100%  2KB    44KB/s    00:00
directory.c                                     100%  2KB    43KB/s    00:00
```

Open a second terminal and log in to Lawrence, then list directories.  The file file.name has been transferred.

```
[user.name@login@login some.folder]$ ls
file.name
```

The last line in the first terminal gives stats on the transfer.  In a second terminal, where you are logged into Lawrence, you can check that the file was transferred and put into some.folder.

You can also use scp for other data transfer applications including HPC to local PC, between HPCs, and between PCs. To transfer files from Lawrence to your PC, (while not logged in to Lawrence) simply switch the two paths in the scp command (numbers 2 and 3), and move the filename to the end of the first path.  If needed, change "usd.local" to the reference for your institution.

```
[local@xyz ~]$ scp User.Name@Lawrence.usd.edu:/home/usd.local/user.name/some.folder/file.name  ./pathTo/file/
user.name@lawrence.usd.edu's password: 
file.name              100% 8893     8.7KB/s   00:00
```
