cp -pd question
am 07.04.2008 16:42:35 von enjoyfate
hi,guys:
I want to cp a symbolic links,not only preserve the symbolic links
itself,but also preserve the mode,ownership,timestamps. so used
the -pd OPTIONs. but it seems that does not work well to get
the prospective effect . Timestamps did not saved . Here is my code
stan@stan /temp/testdirectory $ ls -al
total 28
drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 .
drwxr-xr-x 4 stan root 16384 2008-04-04 21:24 ..
lrwxrwxrwx 1 stan users 6 2008-04-02 22:58 soft_link_to_source ->
source
-rw-r--r-- 2 stan users 21 2008-03-29 22:19 source
stan@stan /temp/testdirectory $ cp soft_link_to_source test -dp
stan@stan /temp/testdirectory $ ls -al
total 28
drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 .
drwxr-xr-x 4 stan root 16384 2008-04-04 21:24 ..
lrwxrwxrwx 1 stan users 6 2008-04-02 22:58 soft_link_to_source ->
source
-rw-r--r-- 2 stan users 21 2008-03-29 22:19 source
lrwxrwxrwx 1 stan users 6 2008-04-07 22:07 test -> source
How to do that ,I would appreciate if someone could help me to get rid
of this
doubt.
Thanks a lot.
Re: cp -pd question
am 07.04.2008 17:19:34 von Icarus Sparry
On Mon, 07 Apr 2008 07:42:35 -0700, enjoyfate wrote:
> hi,guys:
> I want to cp a symbolic links,not only preserve the symbolic links
> itself,but also preserve the mode,ownership,timestamps. so used the
> -pd OPTIONs. but it seems that does not work well to get the
> prospective effect . Timestamps did not saved . Here is my code
> stan@stan /temp/testdirectory $ ls -al
> total 28
> drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 . drwxr-xr-x 4 stan root
> 16384 2008-04-04 21:24 .. lrwxrwxrwx 1 stan users 6 2008-04-02 22:58
> soft_link_to_source -> source
> -rw-r--r-- 2 stan users 21 2008-03-29 22:19 source stan@stan
> /temp/testdirectory $ cp soft_link_to_source test -dp stan@stan
> /temp/testdirectory $ ls -al total 28
> drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 . drwxr-xr-x 4 stan root
> 16384 2008-04-04 21:24 .. lrwxrwxrwx 1 stan users 6 2008-04-02 22:58
> soft_link_to_source -> source
> -rw-r--r-- 2 stan users 21 2008-03-29 22:19 source lrwxrwxrwx 1 stan
> users 6 2008-04-07 22:07 test -> source
>
> How to do that ,I would appreciate if someone could help me to get rid
> of this
> doubt.
>
> Thanks a lot.
The system call that is used to set the access and modification time on a
file (utimes or utime) does not work on symbolic links.
Perhaps you can tell us why you think you need it?
Re: cp -pd question
am 08.04.2008 14:58:02 von enjoyfate
On Apr 7, 11:19 pm, Icarus Sparry wrote:
> On Mon, 07 Apr 2008 07:42:35 -0700, enjoyfate wrote:
> > hi,guys:
> > I want to cp a symbolic links,not only preserve the symbolic links
> > itself,but also preserve the mode,ownership,timestamps. so used the
> > -pd OPTIONs. but it seems that does not work well to get the
> > prospective effect . Timestamps did not saved . Here is my code
> > stan@stan /temp/testdirectory $ ls -al
> > total 28
> > drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 . drwxr-xr-x 4 stan root
> > 16384 2008-04-04 21:24 .. lrwxrwxrwx 1 stan users 6 2008-04-02 22:58
> > soft_link_to_source -> source
> > -rw-r--r-- 2 stan users 21 2008-03-29 22:19 source stan@stan
> > /temp/testdirectory $ cp soft_link_to_source test -dp stan@stan
> > /temp/testdirectory $ ls -al total 28
> > drwxr-xr-x 2 stan users 4096 2008-04-07 22:07 . drwxr-xr-x 4 stan root
> > 16384 2008-04-04 21:24 .. lrwxrwxrwx 1 stan users 6 2008-04-02 22:58
> > soft_link_to_source -> source
> > -rw-r--r-- 2 stan users 21 2008-03-29 22:19 source lrwxrwxrwx 1 stan
> > users 6 2008-04-07 22:07 test -> source
>
> > How to do that ,I would appreciate if someone could help me to get rid
> > of this
> > doubt.
>
> > Thanks a lot.
>
> The system call that is used to set the access and modification time on a
> file (utimes or utime) does not work on symbolic links.
>
> Perhaps you can tell us why you think you need it?
> The system call that is used to set the access and modification time on a
> file (utimes or utime) does not work on symbolic links.
>
> Perhaps you can tell us why you think you need it?
Thanks Icarus Sparry reply.
I just want to copy a symbolic links preserving the mode
ownership timestamps just as copy files do. As your mention , the
system call does not work on symbolic links , why ?