Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
| cp -r -p <src> <dest> to copy recursively and preserves file | attributes. One thing missing from this is that novices are usually rather surprised and disappointed that, if <src> is a directory, this doesn't make <dest> a copy of <src>. Rather, it creates a subdirectory of <dest> named the same as <src> and puts the files there. This is almost always not what was expected. There has never been a simple way to get the unix cp command to simply copy one directory to another. For example, if you try "cp -rp foo bar" and bar is already a bar directory, you find that there's now a bar/foo directory, and it contains copies of the files in foo. That's not what you wanted, so you try "cp -rp foo/* bar", and find that it almost works, but none of the hidden files are copied. So next you try to get those copied by "cp -rp foo/* foo/.* bar", and what this does is copies all of foo/.. into bar. Oops... The cleanest way to make <dest> into a copy of <src> is with a tar or cpio command. For example: tar cf - <src> | (cd <dest>; tar xpf -) or find <src> -print | cpio -pdum <dst> (This was taken from a BSD man pages. For some reason, the linux man pages for tar and cpio give no examples. Neither do the "info" docs. I'm not really impressed here. This is really not excusable for such complex commands. ;-) -- What if the Hoky Poky really IS what it's all about?
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |