Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to deploy a list of file from inside a file let's say files.lst:

+ .profile
+ .hg/hgrc
+ .mc/*
- /*

rsync -vvltr . --include-from 'files.lst' . destdir

Desired behaviour:

  • copy recusively all the files and directories from .mc
  • copy only .hg/hgrc file to destination, ignoring other files that could exist in that directory
  • copy .profile
share|improve this question
    
You mean john@server: right? Otherwise, it would try to sync to a directory called 'john@server' and fail. –  Kyle Smith Apr 18 '12 at 14:14
1  
Could you define doesn't work proper? Wrong files? To many files? Wrong location? Because the --include-files file.LIST // --include FILE is the way to go. –  Tabakhase Apr 18 '12 at 14:15
1  
Did you really ask anyone in here to test before post? Is this a joke?! –  pfo Apr 18 '12 at 14:32
    
@pfo it wasn't a joke, it's so easy to add a meaningless comments instead of verifying that what you think really works. –  sorin Apr 18 '12 at 14:41
1  
Don't worry, with a 43% accept rate and that kind of attitude, you're not going to see much positive feedback. –  SpacemanSpiff Apr 18 '12 at 14:50
show 1 more comment

closed as off topic by pfo, Zoredache, Khaled, MikeyB, MDMarra May 17 '12 at 19:12

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

Finally, I managed to make it working, definitely I would never recommend rsync to any average PC user (the one that never heard of man or SF).

+ .profile
+ .mc
+ .mc/***
+ .hg
+ .hg/hgrc
- /***

Explanations:

  • you need to specify the directory first because otherwise it skip them
  • the last line tells rsync to exclude everything that wasn't explicitly included.
share|improve this answer
    
You mean any average user who doesn't know how to RTFM. –  SpacemanSpiff Apr 18 '12 at 14:49
    
Dude, you have an attitude problem which we call trolling, man was the first thing I opened and it does not include information about the patters and how they work. Instead I managed to find the solution on another question on SF, but after spending too much time for a simple problem like this. –  sorin Apr 18 '12 at 14:57
2  
I would recommend rsync to any Linux/UNIX system user for this purpose, it's a fantastic tool. Like most fantastic tools, it requires some patience and learning. –  Kyle Smith Apr 18 '12 at 15:08
    
What would you recommend? Windows Exploder? –  Tim Apr 18 '12 at 15:33
    
I must agree with @SorinSbarnea: Only above-average people use rsync. ;-) . –  Steven Monday Apr 18 '12 at 15:40
show 2 more comments

You want the --files-from option.

rsync --files-from=files.lst destination:/location/

man rsync

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.