Here's one that's been a puzzler for me. At the command line, I would like to recursively copy files and directories to an existing directory, along with any hidden files within those directories. I know that cp can copy files recursively with -R, and preserve their permissions, etc, with -p, but I haven't been able to get the desired results.
The following
cp -Rp /pathtodirectory/old/ /pathtodirectory/new/
gets me what I want, unless /pathtodirectory/new/ already exists. If it exists, I'll end up with /pathtodirectory/new/old/
And this
cp -Rp /pathtodirectory/old/* /pathtodirectory/new/
copies everything except hidden files.
I'm totally stumped at this point. Any pointers in the right direction would be appreciated.
How to cp files, including hidden, to an existing directory?
Moderators: snarkout, Patrick, dann
-
brakthepoet
- Posts: 39
- Joined: Wed Sep 14, 2005 2:48 pm
-
brakthepoet
- Posts: 39
- Joined: Wed Sep 14, 2005 2:48 pm