Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-26-2009
Registered User
 

Join Date: Apr 2009
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
rsync exclude option

Hi Frdz,

i am using rsync to transfer files from source to destination. but i have one criteria like i have to tranfer only links from source to destination.

in home/test/po folder i have

kiran/test1 -> /home/test/lo/fg
kiran/test2 -> /home/test/lo/fg2

like links are available.
and i am running the following command.

rsync -rvcpogtl -e "ssh -p1223" --exclude='?' /home/test/toDay/ username@hostname:/home > test.log


what to place in the value of exclude option??
Sponsored Links
    #2  
Old 06-02-2009
otheus's Avatar
otheus otheus is offline Forum Advisor  
Smartass
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 2,106
Thanks: 8
Thanked 32 Times in 31 Posts
Instead of --exclude, you can do --files-from=- to get from stdin the list of files to rsync. So you can do:

Code:
find /home/test/po -type l -print | rsync -rvcpogtl -e "ssh -p1223" --files-from=- /home/test/po username@hostname:/home >test.log

Be careful though and do a dry-run and a limited wet-run first. You have three different directories: the one find uses, the one rsync starts from, and the destination of rsync. Find outputs absolute path names, and combined with the -r option, this can have unexpected results. You might need to run find's output through sed to remove the starting path name, for instance.

Last edited by Yogesh Sawant; 12-10-2010 at 05:05 AM.. Reason: added code tags
Sponsored Links
Closed Thread

Tags
rsync

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 - exclude statement not working em23 Shell Programming and Scripting 1 08-21-2008 06:47 PM
Creating and using a /.rsync/exclude komputersman Shell Programming and Scripting 0 03-19-2008 05:13 PM
TAR : option to exclude absolute path telco UNIX for Dummies Questions & Answers 1 06-19-2007 11:25 PM
rsync with the --delete option sallender UNIX for Dummies Questions & Answers 1 10-22-2005 09:52 AM
rsync with the --delete option. sallender UNIX for Advanced & Expert Users 2 10-21-2005 11:55 AM



All times are GMT -4. The time now is 12:43 AM.