Specify Includes Only

Paul rsync908347 at rainslide.net
Sat Mar 13 16:33:43 MST 2010


Hi, sorry if this has been asked before, but I just can't find anywhere on the net that tells me how to do this. I've been trying for ages to get this right, using various forms of --include-from, --exclude, --filter, etc.

I want to copy only specific directories that contain specific filetypes, from sourcedir to destdir. For example, I want to copy all .mp3 and all .ogg files found in the GroupA, GroupC directories under /home/paul/sourcedir/. For example, if I have

/home/paul/sourcedir/GroupA/Album1/song.mp3
/home/paul/sourcedir/GroupA/Album1/cover.jpg
/home/paul/sourcedir/GroupA/Album2/song.ogg
/home/paul/sourcedir/GroupA/Album2/cover.jpg
/home/paul/sourcedir/GroupB/Album1/song.mp3
/home/paul/sourcedir/GroupC/Album1/song.mp3
/home/paul/sourcedir/GroupC/Album1/song2.mp3

then I want to end up with

/home/paul/destdir/GroupA/Album1/song.mp3
/home/paul/destdir/GroupA/Album2/song.ogg
/home/paul/destdir/GroupC/Album1/song.mp3
/home/paul/destdir/GroupC/Album1/song2.mp3

I have tried various forms of

+ *.mpg
+ *.ogg
+ /GroupA/***
+ /GroupC/***

into an --include-from file, but it just copies everything under GroupA and GroupC, regardless if it's .mp3 and .ogg.

Is there no way to do this: "copy these extensions in these directories"? I don't want to specify the extensions to NOT include, because they could be anything, I know that I just want mp3 and ogg types.

Thank you!

-- 

.


More information about the rsync mailing list