Home Man
Today's Posts

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Rsync move with symlinks

rsync, symlinks

👤 Login to reply

Thread Tools Search this Thread
# 1  
Old 11-05-2014
Rsync move with symlinks

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?
# 2  
Old 11-05-2014
None of the many symlink related options work?
-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
# 3  
Old 11-05-2014
Originally Posted by DGPickett
None of the many symlink related options work?
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.
# 4  
Old 11-07-2014
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?
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Rsync and Move files James0806 Shell Programming and Scripting 4 05-01-2018 05:23 PM
Rsync Error: rsync: link_stat failed: No such file or directory (2) mohtashims Shell Programming and Scripting 2 02-06-2018 09:21 AM
Move directory recursive and leave symlinks at source carnagel Shell Programming and Scripting 5 12-14-2017 10:26 AM
Move directory with rsync and delete from source Siddheshk UNIX for Beginners Questions & Answers 2 05-20-2017 04:18 AM
Find + Symlinks = me confused nitrobass24 Shell Programming and Scripting 2 09-01-2012 07:41 AM
Look for, backup and delete symlinks Phil3759 Shell Programming and Scripting 2 08-27-2012 04:50 PM
preserve timestamp of symlinks using rsync KiranKumarKarre Shell Programming and Scripting 1 06-18-2009 10:24 AM
Bash rsync but move not delete Movomito Shell Programming and Scripting 1 04-30-2008 04:37 PM
Symlinks ct1977 UNIX for Dummies Questions & Answers 1 02-21-2008 05:15 PM
Nested Symlinks? deckard Shell Programming and Scripting 0 09-07-2007 03:07 PM

All times are GMT -4. The time now is 05:56 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
Show Password