I want to create an empty directory with some permissions and owned by user
apache:apache. I could just
chown it and
chmod it, but in directory where I want to create it I have a directory with just the permissions and owner I need.
So I want to do sth like:
cp old_dir new_dir but with permissions and owners.
To preserve the permissions option
-p is used, so the command should be
cp -p old_dir new_dir. But that one returns the error:
cp: omitting directory ‘field’.
It would work with options
-rp or better
old_dir contains some dirs and files and I just want to copy the empty directory.
I also tried using
--parents option (
cp -p --parents old_dir new_dir) which creates any missing intermediate directories but then I get this error:
cp: with --parents, the destination must be a directory.
How do I do that? (bonus points for not using