LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-26-2008, 04:52 PM   #1
djeikyb
Member
 
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Rep: Reputation: 33
rsync, inclusions and exclusions


I'm trying to copy a bunch of ISOs from one directory to another.

The source directory has the ISOs I want in a complex hierarchy of folders. I don't want that hierarchy copied to the destination, I just want the ISOs.

I want rsync to recursively search the source for directories called "base", and take the ISO from inside. But it should first exlude everything from any directory called "yeti".

So far I have:

Code:
rsync //samba/ ./ -nrvvP --include "*base*.iso" --include "*/" --exclude "yeti/" --exclude "*"
I'm not satisfied:
1. It will preserve the complex hierarchy.
2. It doesn't exclude yeti directories, or matchable files within yeti directories.

I'll keep hacking away at it, but help will be appreciated!
 
Old 02-26-2008, 07:18 PM   #2
djeikyb
Member
 
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Original Poster
Rep: Reputation: 33
I've solved #2.

Code:
--exclude "*/yeti/*" --include "*/" --include "*/base*.iso" --exclude "*"
Does it matter what order the rules are in?
 
Old 02-28-2008, 05:03 PM   #3
djeikyb
Member
 
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Original Poster
Rep: Reputation: 33
I still haven't figured how to get files without the original folder hierarchy.
 
Old 02-28-2008, 06:25 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
It's not compulsory to do everything on one line, contrary to a lot of answers you see here
Why don't you extend that line to be a short script that derives the necessary dir/filenames and then feeds them to the rsync cmd.
Much easier to debug as well.
 
Old 03-04-2008, 01:45 PM   #5
djeikyb
Member
 
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Original Poster
Rep: Reputation: 33
Ah, yes, piping the results of find into rsync did exactly what I wanted. Didn't even have to muck around with rsync's include/exclude thing! Got too stuck on using only one tool.

I eventually used something like:
Code:
find //samba/ -name "base*.iso" | grep "^yeti" | rsync -P
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM
anyone use rsync? enine Linux - General 6 03-27-2006 01:57 PM
Backup exclusions for RedHat 7.3 Web server? Tenover Linux - General 7 01-31-2006 10:29 PM
rsync / sh help chrisfirestar Linux - Software 3 01-26-2006 10:43 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration