I cannot find a way to copy a directory to another location with all attributes (mode, ownership, timestamps) but withOUT recursion (after so many years of working with Linux).
Say I want to create /home/jail/tmp exactly like /tmp but with nothing in it. Here is what I tried:
Hi Don Cragun and thanks for your concern,
No I only want to copy the directory and its attributes, not the files nor the other folders in it.
------ Post updated at 15:15 ------
Hi jim mcnamara and thanks for your interest,
That technic would fail to copy any folder with nod other than 7777.
It would fail to copy /etc/sudoers.d to /home/jail/etc/sudoers.d and also fail to copy /var/run to /home/jail/var/run
What I want is to copy a folder and its attributes and nothing else.
I'm looking for a command that does what this script does:
Sorry I misunderstood what you were trying to do. Try:
pax -dLrw -p e /tmp /home/jail
if you're trying to create /home/jail/tmp with the same characteristics as /tmp or:
pax -dLrw -p e /tmp /home/jail/tmp
if you're trying to create /home/jail/tmp/tmp with the same characteristics as /tmp .
Note that on my system, /tmp is a symbolic link pointing to private/tmp . If /tmp can never be a symbolic link anywhere you might want to try this, you can leave out the pax -L option.
Note, however, that the destination directory ( /home/jail or /home/jail/tmp in the above two examples) must exist before you invoke pax .