Unix/Linux Go Back    


Shell Programming and Scripting 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

Shell Programming and Scripting


Tags
rsync, symlinks

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 11-05-2014   -   Original Discussion by huangyingw
huangyingw's Unix or Linux Image
huangyingw huangyingw is offline
Registered User
 
Join Date: Nov 2014
Last Activity: 5 November 2014, 5:27 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rsync move with symlinks

Hi,
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?
Sponsored Links
    #2  
Old Unix and Linux 11-05-2014   -   Original Discussion by huangyingw
DGPickett's Unix or Linux Image
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 February 2016, 3:35 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,673
Thanks: 8
Thanked 587 Times in 560 Posts
None of the many symlink related options work?
Quote:
-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
Sponsored Links
    #3  
Old Unix and Linux 11-05-2014   -   Original Discussion by huangyingw
huangyingw's Unix or Linux Image
huangyingw huangyingw is offline
Registered User
 
Join Date: Nov 2014
Last Activity: 5 November 2014, 5:27 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by DGPickett View Post
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 Unix and Linux 11-07-2014   -   Original Discussion by huangyingw
DGPickett's Unix or Linux Image
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 February 2016, 3:35 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,673
Thanks: 8
Thanked 587 Times in 560 Posts
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?
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
preserve timestamp of symlinks using rsync KiranKumarKarre Shell Programming and Scripting 1 06-18-2009 11:24 AM
Bash rsync but move not delete Movomito Shell Programming and Scripting 1 04-30-2008 05:37 PM
Symlinks ct1977 UNIX for Dummies Questions & Answers 1 02-21-2008 06:15 PM
Nested Symlinks? deckard Shell Programming and Scripting 0 09-07-2007 04:07 PM



All times are GMT -4. The time now is 04:24 PM.