LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-21-2008, 05:31 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
having problems including only certain files in rsync


I'm trying to rsync only those files (and the dirs that contain them) that are in a directory called "1920x1080". That directory is in $source/foo/bar/1920x1080

I'm trying to rsync like so:
rsync -rptgoDLKvn --include="*1920*" $source $dest

... but it's still grabbing everything (the 'n' is in there for testing)

It should be known that many of the directories (including "1920x1080") in the path are symlinks that point to all sorts of different places (some pointing outside of the tree). I've managed to get them all acting like real dirs (hence the long option list, thanks LQ), but can't manage to get the include working. I don't want to use a filter rules file as the include will eventually come from user input.

any ideas?
 
Old 02-23-2008, 03:48 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Since this has come around a couple of times without response, I'll pitch in and say maybe you should restate your problem. First, it works for me - as near as I can figure.
Code:
:mkdir sys/rsyncdest sys/tmp/rsynctest

:touch sys/tmp/rsynctest/file

:rsync -avz --include='*rsynctest*' sys/tmp/rsynctest sys/rsyncdest/
building file list ... done
rsynctest/
rsynctest/file

sent 137 bytes  received 48 bytes  370.00 bytes/sec
total size is 0  speedup is 0.00

:ls -F sys/tmp/
rsynctest/  nfl.css  nfl.xml

:find sys/rsyncdest/
sys/rsyncdest/
sys/rsyncdest/rsynctest
sys/rsyncdest/rsynctest/file
Second, if you want to rsync '$source/foo/bar/1920x1080', then why not do 'rsync -avz $source/foo/bar/1920x1080 $dest'? And when you say "it's still grabbing everything", what is 'everything'? Everything in $source? And here the ground opens up: 'I don't want to use a filter rules file as the include will eventually come from user input.' So this is part of an interactive script for hapless users? Information about that would probably be important.

I'm not sure I can help because, while I swear by rsync and use it religiously, I just figured out what I wanted to do and put it in a script so I wouldn't have to think about it much again. The filters/include/exclude can be tricky, too.
 
Old 02-25-2008, 12:42 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by digiot View Post
Since this has come around a couple of times without response, I'll pitch in and say maybe you should restate your problem. First, it works for me - as near as I can figure.
Thanks for the response. As a repeatable example, try this:
Code:
mkdir /tmp/rsynctest
touch !$/file1
mkdir ~/rtest
cd ~/rtest
mkdir source
mkdir dest
ln -s /tmp/ source/
ls -l source/ <shows the link in source to /tmp>
cd dest/
rsync -rptgoDLKv --include="*rsynctest*" ../source/ .
<notice - everything copied>
Quote:
Second, if you want to rsync '$source/foo/bar/1920x1080', then why not do 'rsync -avz $source/foo/bar/1920x1080 $dest'?
because 1920x1080 may exist in more than one place. While I could go in and find where it exists as a pre-process, I'd rather use the power rsync gives me by only including certain files.
Quote:
And when you say "it's still grabbing everything", what is 'everything'? Everything in $source?
Yes, it's grabbing files/directories that do not match "1920", therefore the include is not working - at least in the example where there are lots of symbolic links.
Quote:
And here the ground opens up: 'I don't want to use a filter rules file as the include will eventually come from user input.' So this is part of an interactive script for hapless users? Information about that would probably be important.
I don't see why this is incredibly important, but yes, this is a script. It's meant for non-linux types that need to transfer data from a file server to their local machine. They run it by typing "localize 1920x1080" or "localize 640x486" or "localize some_thing"

Quote:
I'm not sure I can help because, while I swear by rsync and use it religiously, I just figured out what I wanted to do and put it in a script so I wouldn't have to think about it much again.
Well, thanks for the reply if nothing else. I use rsync all the time as well - just don't often use includes & even less often have to follow symlinks outside of the rsync'd tree.

Last edited by BrianK; 02-25-2008 at 12:50 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
undelete folder including files p41elvis Linux - General 6 10-20-2006 02:56 AM
Including header files and source files for classes Feenix Programming 8 09-28-2005 10:53 AM
How to write Makefile in 2.6 for including header files in another dir ? ashbalu Programming 0 10-19-2004 03:45 PM
Including files and permissions kidestranged Linux - General 2 07-27-2004 07:31 PM
including files with Kdevelop shyam_d_sundar Linux - Newbie 1 03-14-2004 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:12 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