rsync exclude option


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rsync exclude option
# 1  
Old 05-26-2009
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??
# 2  
Old 06-02-2009
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 06:05 AM.. Reason: added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync exclude & include?

hi I have a few folders and a few files , for example Directory A B C D E Files 1 2 3 4 5 I want B directory and "2" File that does not sync But other directories and file sync What is the solution ? Is there a way to sync time is under one minute? os centos 6.8 thanks... (5 Replies)
Discussion started by: mnnn
5 Replies

2. UNIX for Dummies Questions & Answers

Exclude txt file in rsync

Hi Folks, I'm using rsync on Solaris 10 to backup a web server and need to exclude the cache and tmp directories. The man pages and google on rsync --exclude are ambiguous but I have tried--exclude=".*" and --exclude/remote_server/absolute_path with success only on the tmp files. Rather than make... (2 Replies)
Discussion started by: SmokeyJoe
2 Replies

3. Shell Programming and Scripting

Little help with rsync --exclude

Loving the rsync command and beginning to write some scripts with it. However I'm hung up on the --exclude function. Script is tested and works great BEFORE I put the --omit in. What am I doing wrong in my syntax? rsync $OPTS /cis/cloverleaf/cis6.0/integrator/... (2 Replies)
Discussion started by: B_ROX
2 Replies

4. Shell Programming and Scripting

Synchronization, rsync option

Dear all, I am synchronizing some files on 2 hosts. host2 is a backup server of host1, but can have some more up to date files. I use on host2: rsync -auv usrer@host1:/Source_Dir Dest_DirOption -u (update) will copy and replace the newest files from host2 to host1. Before this is done I... (1 Reply)
Discussion started by: freddie50
1 Replies

5. UNIX for Dummies Questions & Answers

cmd find: exclude directory when using option -depth

hello, i want to use "-depth" in command "find" and want to exclude a directory. the find command should work in HP-UX and Linux. i see in the find man page: -prune If -depth is not given, true; do not descend the current directory. If -depth is given, false; no effect. -depth... (3 Replies)
Discussion started by: bora99
3 Replies

6. Shell Programming and Scripting

complicated exclude option in find command

Hi all, In a directory, I have many video files. Example : As you can see, some of the video files come with a .aspx file (wich means the video is actually being uploaded and not entirely written on the FS) I try to write a bash script that would find all video files in the ... (1 Reply)
Discussion started by: gniagnia
1 Replies

7. Shell Programming and Scripting

rsync - exclude statement not working

hey all, i'm trying to rsync some dir's and files between servers and i've added an exclude statement, but it still goes out and tries to rsync the directory. I've tried the following: --exclude="/export/home/zones/lab" as well as: --exclude=/export/home/zones/lab and also:... (1 Reply)
Discussion started by: em23
1 Replies

8. Shell Programming and Scripting

Creating and using a /.rsync/exclude

Hello all, Everyone has been awesome assisting with my rsync script... Now I want to clean it up. I think the best way for me to exclude many files might be to use a rsync exclude file. So in my script I add So now then, here is my .rsync/exclude... So what is happening is the... (0 Replies)
Discussion started by: komputersman
0 Replies

9. UNIX for Dummies Questions & Answers

TAR : option to exclude absolute path

Dear All , :D I have a question ... I need to exclude the absolute path in the TAR process. For example : system("tar cvf /root/BACKUPS_$fecha.tar /root/BKP/"); system("gzip /root/BACKUPS_$fecha.tar"); I need to exclude de path " /root/BKP/ " in the file.tar.gz What is the parameter to... (1 Reply)
Discussion started by: telco
1 Replies

10. UNIX for Dummies Questions & Answers

rsync with the --delete option

Tell me this - set me straight! The --delete option says "delete files that don't exist on the sending side" Does this mean and only mean that it will delete files from the DESTINATION that DON'T EXIST on the sending side? :confused: (1 Reply)
Discussion started by: sallender
1 Replies
Login or Register to Ask a Question