Created
April 3, 2018 22:29
-
-
Save alexfornuto/a575b1a2a3492b632dfc94a5336a0af4 to your computer and use it in GitHub Desktop.
Rsync Symlink Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ~ $ cd tmp/ | |
$ ~/tmp $ ls | |
$ ~/tmp $ mkdir rsync-dir | |
$ ~/tmp $ mkdir not-rsynced | |
$ ~/tmp $ echo "Derp" > not-rsynced/file.txt | |
$ ~/tmp $ echo "Herp" > rsync-dir/localfile.txt | |
$ ~/tmp $ cd rsync-dir/ | |
$ ~/tmp/rsync-dir $ ln -s localfile.txt local-symlink.txt | |
$ ~/tmp/rsync-dir $ cat local-symlink.txt | |
Herp | |
$ ~/tmp/rsync-dir $ ln -s ../not-rsynced/file.txt ext-symlink.txt | |
$ ~/tmp/rsync-dir $ cat ext-symlink.txt | |
Derp | |
$ ~/tmp/rsync-dir $ ls -al | |
total 12 | |
drwxrwxr-x. 2 alex alex 4096 Apr 3 17:13 . | |
drwxrwxr-x. 4 alex alex 4096 Apr 3 17:09 .. | |
lrwxrwxrwx. 1 alex alex 23 Apr 3 17:13 ext-symlink.txt -> ../not-rsynced/file.txt | |
-rw-rw-r--. 1 alex alex 5 Apr 3 17:11 localfile.txt | |
lrwxrwxrwx. 1 alex alex 13 Apr 3 17:13 local-symlink.txt -> localfile.txt | |
$ ~/tmp/rsync-dir $ cd .. | |
$ ~/tmp $ rsync --copy-unsafe-links rsync-dir/ ~/copied-dir | |
skipping directory . | |
$ ~/tmp $ rsync -r --copy-unsafe-links rsync-dir/ ~/copied-dir | |
skipping non-regular file "local-symlink.txt" | |
$ ~/tmp $ rsync -rl --copy-unsafe-links rsync-dir/ ~/copied-dir | |
$ ~/tmp $ cd ~/copied-dir/ | |
$ ~/copied-dir $ ls -al | |
total 16 | |
drwxrwxr-x. 2 alex alex 4096 Apr 3 17:15 . | |
drwx------. 37 alex alex 4096 Apr 3 17:14 .. | |
-rw-rw-r--. 1 alex alex 5 Apr 3 17:15 ext-symlink.txt | |
-rw-rw-r--. 1 alex alex 5 Apr 3 17:15 localfile.txt | |
lrwxrwxrwx. 1 alex alex 13 Apr 3 17:15 local-symlink.txt -> localfile.txt | |
$ ~/copied-dir $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment