Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 12-23-2004, 07:03 AM   #1
LQ Newbie
Registered: Sep 2004
Location: au.vic.melb
Distribution: Fedora 7 x3, FC6, FC3.
Posts: 27

Rep: Reputation: 15
how to rsync ex/include select specific directories ?

I am trying to set up some rsync scripts, and have been successful. However, now I want to instruct rsync to copy files in specific directory to limit the backup that will happen over a slow link.
my source structure is:
I want to sync only files within folder b and files within folder m. [1,2 are files]
While I have re/read man rsync many times, and --dry-run with at least 100 combinations, I either get the whole tree copied, or I get no files copied. One test gave me folder b and it's files, but also copied files in folders below the required folder.

In other web answers, there seems to be some tricks like **, and including then excluding the same directoy, but still no success.

rsync --dry-run -az --exclude-from=exclude.lst --include-from=include.lst /data/ remote:/data/

it made sense to me to excude all:
but include:

Any pointers, or exact in/exclude list setup would be very welcome ?

Last edited by dtimms; 12-23-2004 at 07:04 AM.
Old 01-11-2005, 05:16 AM   #2
LQ Newbie
Registered: Sep 2004
Location: au.vic.melb
Distribution: Fedora 7 x3, FC6, FC3.
Posts: 27

Original Poster
Rep: Reputation: 15
here is one way to achieve -

Well, looked like nobody has done this before, so eventually I worked it out. Note: using separate include - nogo. also, - in either file is supposed to be an exclude. but i couldn't make it work, bettter with just a single exclude.

rsync --dry-run -az --exclude-from=exclude.lst /data/ remote:/data/

#dont backup outlook pst files they/re huge
- *.pst
- *.PST

#files in folders b, not subfolders
+ /a
+ /a/b
+ /a/b/*
## note use ** at end of previous line to do b and all files/folders below it.

#files in folder/ms, not subfolders
+ /m
+ /m/*

#dont back up anything else (that hasn't already been mentioned)
- *

Now I get a single rsync run that backs up (to a remote internet machine) just the most inportant is a slow link after all, with the stats option listing the file / change d and transmitted file sizes.

Chime in if there is a simpler way, or even just to say thanks...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 syntax to skip directory, but copy select files.. tnicol Linux - Software 3 07-24-2007 05:40 AM
GtkFileChooserDialog: How to select both, files and directories? froedi Programming 0 06-11-2005 07:07 AM
RSYNC and include?? JediKnight2 Linux - Software 0 02-04-2005 11:52 AM
How do I force a TrueMobile 1500 to select a specific access point? ketchers Linux - Wireless Networking 1 08-21-2004 05:35 PM
How to include library directories? davee Programming 7 04-05-2004 05:41 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:12 PM.

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