Transferring Files

This section explains how to transfer files between the supercomputing system and your PC. It is assumed that Logging In to the System has already been completed.

File Transfer Using sftp

Files are transferred using the sftp command from “Command Prompt” on Windows, or “Terminal” on macOS and Linux.

$ sftp super.sc.imr.tohoku.ac.jp
Enter passphrase for key ‘/home/pc-user/.ssh/keys/id_rsa’:
sc-user@super.sc.imr.tohoku.ac.jp's password:
Connected to super.sc.imr.tohoku.ac.jp.
sftp>

Unless specified otherwise, the remote directory is the user’s home directory.

The basic commands are described below.

Command

Function

ls [directory_name]

Displays the contents of the remote (destination) directory.

cd [directory_name]

Changes the remote current directory.

lls [directory_name]

Displays the contents of the local (source) directory.

lcd [directory_name]

Changes the local current directory.

put [file_name]

Transfers a local file to the remote current directory.

put -r [directory_name]

Transfers a local directory to the remote current directory.

get [file_name]

Transfers a remote file to the local current directory.

get -r [directory_name]

Transfers a remote directory to the local current directory.

help

Displays sftp usage and help.

exit

Terminates the connection.

Attention

When transferring files with the put or get commands, if a file with the same name already exists at the destination, it will be overwritten.

Below are some usage examples.

  • Transferring a file named test.txt in the local current directory to the remote host:

sftp> put test.txt
Uploading test.txt to /home/sc-user/test.txt
test.txt                                        100%   16     0.8KB/s   00:00
sftp>
  • Copying a directory named test in the remote current directory to the local host:

sftp> get -r test
Fetching /home/sc-user/test/ to test
Retrieving /home/sc-user/test
/home/sc-user/test/test1.txt                    100% 1855    39.0KB/s   00:00
/home/sc-user/test/test2.txt                     100%  354     6.3KB/s   00:00
sftp>

File Transfer Using rsync

Files are transferred using the rsync command from Windows Subsystem for Linux (WSL) on Windows, or “Terminal” on macOS and Linux.

  • Example: Downloading files from the supercomputer to a PC:

$ rsync -auvHAS --stats sc-user@super.sc.imr.tohoku.ac.jp:/home/sc-user/source_directory /destination_directory
Enter passphrase for key ‘/home/pc-user/.ssh/keys/id_rsa’: your_ssh_passphrase
password: your_password
receiving incremental file list
...
  • Example: Uploading files from a PC to the supercomputer:

$ rsync -auvHAS --stats /source_directory sc-user@super.sc.imr.tohoku.ac.jp:/home/sc-user/destination_directory
Enter passphrase for key ‘/home/pc-user/.ssh/keys/id_rsa’: your_ssh_passphrase
password: your_password
sending incremental file list
...

The options used in the above examples are described below. For details, please refer to the rsync manual.

Option

Function

-a , --archive

Preserves attributes (archive mode)

-u , --update

Transfers only files that have been updated

-v , --verbose

Displays detailed execution progress

-H , --hard-links

Preserves hard links

-A , --acls

Preserves Access Control Lists (ACLs)

-S , --sparse

Handles sparse files efficiently

--stats

Displays transfer statistics (number of files, transfer size, etc.) after completion

References