On Thu, 13 Jan 2011, Mag Gam wrote:
bump
On Tue, Jan 11, 2011 at 8:52 PM, Mag Gam wrote:
Hello All,
I am trying to sync 2 directories.
src/year/month/day/fileA.csv
src/year/month/day/fileB.csv
src/year/month/day/fileC.csv
..
src/year/month/day/fileZ.csv
I would to sync only file{B,D,T}.csv to my target directory so it
would look like this.
tgt/year/month/day/fileB.csv
tgt/year/month/day/fileD.csv
tgt/year/month/day/fileT.csv
what is the best way to do this?
rsync -av --prune-empty-dirs --include='*/' --include='file[BDT].csv'
--exclude='*' src/ tgt/
First --include makes sure all directories are considered
Second (and further) --includes should match your file patterns.
The --exclude excludes everything else.
Without the first --include='*/', every directory would be excluded by
--exclude='*', so no directory recursion would take place.
--prune-empty-dirs excludes any directories with no file matches. (Not
obvious from your example whether that's useful/necessary.)
--
Best,
Ben
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html