Transferring Files

by Sophie Engle on Jul 2013

There are multiple ways for you to transfer files between your home computer or laptop and the lab computers. The preferred method is to use SVN (Subversion) or Git. Otherwise, you can either use SCP (secure copy) or SFTP (secure file transfer protocol). Each of these options are detailed below.

Using SVN or Git

Using SVN (or Git) is the easiest way to keep your code synchronized between the lab computers and your home computer. See the Resources page for all of the guides available on using SVN.

If you just need to transfer a file onto the lab computers for testing purposes, and already have that file committed to SVN, you can run the following command:

svn export https://www.cs.usfca.edu/svn/username/filepath

Replace username with your CS username and filepath with the remainder of the path to your file on your code repository. (You can always get the full path of your file by browsing your svn repository via a browser.)

For example, the following screenshot demonstrates how to export a copy of just the project2.jar file onto the lab computer:

If you want to consistently keep your home computer and lab computers synchronized, you should checkout a working copy instead.

Using SCP

Mac and Linux systems already have a tool installed called scp that you can use to securely copy files from the lab computers to your own home computer. If you are on a Windows system, I recommend one of the other methods in this guide.

To transfer all files in a source directory on your local home computer to the lab computer, use the following command from your home computer:

scp -r localdir username@stargate.cs.usfca.edu:remotedir

Replace localdir with the directory on your local computer, username with your CS username, and remotedir with the directory on the lab computer where you want the files to be placed.

To transfer all files in a source directory on the lab computer to your home computer, use the following command from your home computer:

scp -r username@stargate.cs.usfca.edu:remotedir localdir

The following screenshot demonstrates sending files using scp first from the local computer to the lab computer, and second from the lab computer to the local computer:

Both of these transfers are done on the local computer! Also, keep in mind that scp requires the destination directory to already exist. In the example above, the directory ~/cs212/ had to already exist on the lab computer for the command to work.

Using SFTP

You can also install an SFTP client on your computer. There are several free clients for both Windows and Mac. The screenshots below use Transmit for Mac (which is not free). While each SFTP client will look different, the general settings will be the same.

First, there is usually somewhere to specify the protocol to use. It is important you select SFTP and not just FTP (which isn't secure). Enter your CS username and stargate.cs.usfca.edu as the host name. For example:

Once you connect, you should see files on your lab computer. Most programs will let you drag-and-drop files between your home computer and the remote computer.

There is also a free command-line SFTP client from the PuTTY group for Windows, but I recommend a GUI program instead.