Aside: I'm not sure the reason I want to do this is important, but I'll 
mention that it is for backup purposes, and for that reason I want to use the 
-a, -u, and -x options (i.e., -aux) with cp.

Aside: in reading / skimming the man page for cp today I came across the -t 
and -T options which I was not previously aware of -- maybe they are the key 
to this, but I'd like to understand how to do it without those options.  

Further aside: I also tried to do some more googling (ddg'ing) including 
looking for cp on Greg's Wiki, but my google foo wasn't good enough to really 
get to the point (either on Greg's wiki or anywhere else).

To me there are two different situations, and I'll try to explain them by 
examples:

Example 1: sometimes I want to copy an entire directory tree (i.e., with 
subdirectories) to a different location but (rooted) at the same level as the 
directory mount point:

source directory tree: /rhk
destination directory mount point: /back/rhk
desired destination directory tree path: /back/rhk (and not /back/rhk/rhk)

In this case I would expect to use a cp command as follows:

cp -aux /rhk/* /back/rhk/

Example 2: other times I want to copy an entire directory tree (i.e., with 
subdirectories) to a different location but (rooted) one level below the 
directory mount point: 

source directory tree: /rhk
destination directory mount point: /back
desired destination directory tree path: /back/rhk

In this case I would expect to use a cp command as follows:

cp -aux /rhk/* /back/rhk/ <oops??? the same command?? -- would this work?>

I could do an experiment, but I'd rather get some advice first.

Also, there might be a better command than cp to do this, but I'd like to 
understand how to do it with the cp command.  (Aside: there is no need for 
rsync (although it could be used) because the backup disk will be mounted on 
the computer.)

Reply via email to