...
Now press Enter to get the command going. Repeat for the 2nd link. Check that you now see the two files (ls), or tree tree $SCRATCH to see your Scratch directory hierarchy:
...
- -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
- -r – recursively copy sub-directories
- -v means verbose
- -W means transfer Whole file only
- Normally the rsync algorithm compares the contents of files that need to be copied and only transfers the different parts.
- For large files and binary files, figuring out what has changed (diff-ing) can take more time than just copying the whole file.
- The -W option disables file content comparisons (skips diff-ing).
- Files are only copied if their modification date is more recent or the file size is different
Since these are all single-character options, they can be combined after one option prefix dash ( - ). You could also use options -ptlrvW, separately, instead of using -a for "archive mode".
Tip | ||
---|---|---|
| ||
The trailing slash ( / ) on the source and destination directories are very important for rsync – and for other Linux copy commands also! rsync will create the last directory level for you, but earlier levels must already exist. |
Let's copy a directory using rsync. We'll also add the -P option to show Progress as the copy progresses.
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir -p $SCRATCH/data cds rsync -avW -avrWP $CORENGS/custom_tracks/ data/custom_tracks/ |
...
Tip |
---|
The bash shell has several convenient line editing features:
Once the cursor is positioned where you want it:
(Read more about Command line history and editing) |
...
Code Block | ||
---|---|---|
| ||
cat $CORENGS/tacc/dragonfly_access.txt cds mkdir -p data/test2 scp -p corengstools@dragonfly.icmb.utexas.edu:~/custom_tracks/progeria_ctcf.vcf.gz ./data/test2/ tree ./data/test2 |
Notes:
- The 1st time you access a new host the SSH security prompt will appear
- You will be prompted for your remote host password
- for security reasons characters will not be echoed
- The -r recursive argument works for scp also, just like for cp
- The -p argument says to preserve the file's last modification time
- otherwise the last modification time of the local copy will be when the copy was done
...