Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Files we will use in this course are in a sub-directory there:. The $CORENGS environment variable set in your login profile refers to this path.

Code Block
languagebash
titleOur shared class directory
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools

...

Code Block
languagebash
titleSingle file copy with cp
mkdir -p $SCRATCH/data/test1
cp /work/projects/BioITeam/projects/courses/Core_NGS_Tools/$CORENGS/misc/small.fq  $SCRATCH/data/test1/
ls $SCRATCH/data/test1

# or..
mkdir -p ~/scratch/data/test1
cd ~/scratch/data/test1
cp /work/projects/BioITeam/projects/courses/Core_NGS_Tools/$CORENGS/misc/small.fq  .
ls

Copy an entire directory to your scratch area. The -r argument says "recursive".

Code Block
languagebash
titleDirectory copy with cp
cds
cd data
cp -r /work/projects/BioITeam/projects/courses/Core_NGS_Tools/$CORENGS/general/ general/

Exercise: What files were copied over?

...

Both the source and target directories are local (in some file system accessible directly from ls5). Either full or relative path syntax can be used for both. The -ptlrvPavP options above stand for:

  • -a means "archive mode", which implies the following options (and a few others)
    • -p – preserve file permissions
    • -t – preserve file times
    • -l – copy symbolic links as links
    • -rrecursively copy sub-directories
  • -v means verbose
  • -P means show Progress.

Since these are all single-character options, they can be combined after one option prefix dash ( - ). You could also use options -ptlrvP, separately, instead of using -a for "archive mode".

Tip
titleAlways add a trailing slash ( / ) after directory names

The trailing slash ( / ) on the source and destination directories are very important!

rsync will create the last directory level for you, but earlier levels must already exist.

Tip
titleUse -W option when transferring large files

Another useful option is -W (copy Whole files only). In its normal mode, rsync will copy only changed parts of newer files. For large files, figuring out what has changed (diff-ing) can take more time than just copying the whole file. The rsync -W option says to skip diff-ing.

Code Block
languagebash
titlersync (local directory)
cds
rsync -avP /work/projects/BioITeam/projects/courses/Core_NGS_Tools/$CORENGS/custom_tracks/ data/custom_tracks/

...

Code Block
titlePlay a scavenger hunt for more practice
cd
cp -r /work/projects/BioITeam/projects/courses/Core_NGS_Tools$CORENGS/linuxpractice/what what
cd what
cat readme

...