Using rsync to only backup files I specify

JayHall
JayHall used Ask the Experts™
on
I am using rsync to backup data nightly, and it has been working well.  While reviewing some of the data stored on the company server, I am finding there is a great deal of personal data, programs, etc. which has been saved to the company server.  In order to save backup time, and tape, I am trying to limit what files rsync backs up.

Basically, I want to exclude everything, except what I have in the include-from file.

My initial though was to add --exclude "*" --include-from=/aaa/bbb/include_files.txt t the command line.  However, that excluded all of the files and did not backup anything.  Looking back, I see rsync did exactly what I told it to.

What should the command line options be to accomplish this?

Thanks,


Jay
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013

Commented:
Hi,
use
--files-from=FILE
instead of
--include-from
wmp

Author

Commented:
Using --files-from, can wild cards be specified?

Author

Commented:
Re-reading my original post, I do no think I was clear enough as to what i was trying to accomplish.  I would like to only backup certain types of files.  For example, PowerPoint, Word, Excel, etc. So, I will not have the specific name of a file, just the extension.

Thanks,


Jay
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Most Valuable Expert 2013
Top Expert 2013

Commented:
FILE is a file containing  an exact list of files to transfer
Most Valuable Expert 2013
Top Expert 2013

Commented:
So try your --include-from=FILE without --exclude="*"
And consider consulting rsync's docs for a description of the various filter rules - it's just too much to explain here.
http://www.samba.org/ftp/rsync/rsync.html
 
Monis MontherSystem Architect
Commented:
why not make a simple script to accomplish this

for i in .txt .pps .doc. xls
do
  find / -name \*$i >> file-list
done

the above will create a list of files of the extensions you want

Now you can apply wmc's solution in the previous steps or combine both solutions together in one script
Most Valuable Expert 2013
Top Expert 2013
Commented:
--files-from supports standard input ( - ) so why not combine both solutions this way -
find / -name \*.txt -o -name \*.pps -o -name \*.xls | rsync --files-from=-  ...  ...  ...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial