MLUG: Re: [MLUG] cp -R --skip [pattern]?
Re: [MLUG] cp -R --skip [pattern]?
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Thu, 3 May 2007, Mike Miller wrote:

I don't think this exists, but this is what I'd like: A way to copy a directory tree but ignoring certain files, or copying files of a certain type only.

I have a directory tree with MP3 files in it, but there also are HTML files (album reviews) and JPEG files (album covers). I would like to replicate that directory tree without the MP3 files. I know that I could copy the whole thing and then delete the MP3 files, but they are huge and that is not feasible.

I would think there is a simply GNUish Linuxy trick to this, possibly using "find" somehow. I think I see a way to write a script that uses find, but it wouldn't be all that efficient. For example, I can write out the entire directory tree like so:

find . -type d -print

I can process that output to do what I want, but I see no way to do it with xargs -- I would use perl to create a shell script from the output, then execute the shell script. But isn't there a one-liner for this?

It would be great if one of you guys could suggest something.

find ./ -name \*mp3 -exec cp {} /newpath \;

--dlloyd

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members