I use rsync to move from source to target, but there are cases that I need to exclude:
Suppose in my file system, I have a soft link ~/data -> /media/volgrp/data.
Under data folder, there is a file hello.txt.
After moving command "rsync --remove-source-files -aH --force ~/data/ /media/volgrp/data/"
I found that the hello.txt file is deleted, this is not what I want.
Is there any way to exclude this case?
Could some one provide me with a shell script to exclude, or to test whether two folders are actually the same folder?
-l, --links copy symlinks as symlinks -L, --copy-links transform symlink into referent file/dir --copy-unsafe-links only "unsafe" symlinks are transformed --safe-links ignore symlinks that point outside the tree -k, --copy-dirlinks transform symlink to dir into referent dir -K, --keep-dirlinks treat symlinked dir on receiver as dir -H, --hard-links preserve hard links
I don't think they would work, fix me if incorrect
Instead, I Just found the "realpath" command in OS X and Linux, which could test whether the real paths of the source folder and target folder are identical.
There is no substitute for reading the man pages and trying things out to get the behaviors you want. I am not quite sure what you want to achieve. Is this inside one machine, or is that just a test for a remote setup?