OSU Navigation Bar

The Ohio State University

Department of Statistics

Cockins Hall
rollover image OSU Statistics
            Home

design element

OSU Statistics

Home

News

Research & Consulting Groups

People

For Visitors

For Prospective Students

For Current Students, Staff & Faculty

Contact Us



rollover image

For Current Students & Faculty

rollover image

Courses

rollover image

Links

rollover image

Computer Support

rollover image

Internal Documents

rollover image

webmail

Transferring whole directories

Sometime you may have to transfer an entire directory hierarchy from stat to another machine. (Or just reverse these commands to do the opposite.) Most ftp programs do not allow the transfer of whole directories. Thus the traditional method of taring the directory and then ftping the tar file, must be used.

IMPORTANT: If you are doing a lot of files, in terms of size, you must be sure that there is enough space in /tmp and on the remote machine to accommodate the files. If you are not sure how to do this with df and du, contact your support person.

This is a simple outline where remote means the remote machine, and unix is OSU's machine. Explanatory comments follow the commands after a #. Do not type these. This example will transfer an entire home directory, it will work on subdirectories as well.

  remote> cd                            #make sure you're in your home dir
  remote> mkdir tmp_stat                #make a new dir to hold stuff
  remote> ssh mordor.stat.ohio-state.edu
  mordor> cd                              #make sure you're in your home
  mordor> cd ..                   #go one level up
  mordor> tar -cvf /tmp/user.tar user     #create the archive
  mordor> cd                              #go to your home dir again
  mordor> mv /tmp/user.tar .              #move the archive from tmp
  mordor> compress user.tar               #compress it so it is smaller
  mordor> ftp remote.machine.edu  #start the ftp.  Log in.
  ftp> cd tmp_stat                      #cd to the new dir
  ftp> bin                              #make sure you're in binary mode
  ftp> put user.tar.Z                   #transfer the file
  ftp> quit                             #exit ftp
  mordor> exit                            #log off unix
  remote> cd tmp_stat           #cd to the new dir
  remote> zcat user.tar.Z | tar -xvf -  #recreate the directory structure

Some of these commands may take a couple minutes, depending on the size of the directories.

Now you should have all your stat files on the remote machine. Note, compiled programs will not work if the machine is a different type than stat. If this worked you can now remove both .tar.Z files, the one on stat and the remote:

  mordor> rm ~/user.tar.Z
  remote> rm tmp_stat/user.tar.Z


If you have trouble accessing this page, or need an alternate format contact webmaster@stat.osu.edu.