Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
- To: MLUG Members <EMAIL:PROTECTED>
- Subject: Re: [MLUG] cp -R --skip [pattern]?
- From: Stephen Montgomery-Smith <EMAIL:PROTECTED>
- Date: Thu, 03 May 2007 12:11:20 -0500
- Delivery-date: Thu, 03 May 2007 12:12:13 -0500
- Envelope-to: EMAIL:PROTECTED
- In-reply-to: <EMAIL:PROTECTED>
- References: <EMAIL:PROTECTED>
- Reply-to: MLUG Members <EMAIL:PROTECTED>
- Sender: EMAIL:PROTECTED
- User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.2) Gecko/20070425 SeaMonkey/1.1.1
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.
Thanks in advance.
Mike
Maybe something like this? I haven't tested it, but I would think that
something like this would work.
tar cvf --exclude "*mp3" - directory-to-copy \
| (cd where-you-want-copy; tar xfp -)
You can remove the first "v" if you don't want verbose output.
Stephen
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members