Help with cp command
Hi,
Imagine I have the following directories and files in my home directory:
dir1/a.1
dir1/a.2
dir1/junk.2
dir1/otherjunk.3
dir2/b.1
dir2/b.2
dir2/junk.2
dir2/otherjunk.3
...
dir72/x2.1
dir72/x2.2
dir72/junk.2
dir72/otherjunk.3
Now I want to copy over all the ".1" files into a new directory, while keeping them in their sub-directories (thus making copies of the sub-directories as well), while NOT copying over all the other file types (".2", ".3", etc).
So if I'm copying stuff over into a folder called "temp," it'll end up looking like this:
temp/dir1/a.1
temp/dir2/b.1
...
temp/dir72/x2.1
How can I do this with the cp command (or any other command)?
Thanks
Take a look at rsync. Off the top of my head, something like this should do:
rsync -a --exclude=* --include=*.1 /path-from /path-to
rsync -a --exclude=* --include=*.1 /path-from /path-to
<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement