cp a dty without symbolic links?

Hi,

  • we have copy (cp command) to do to save all the contents of a dty BUT we dont want to copy the files corresponding to symbolic links contained whithin this dty

  • the box is a sun solaris one - and the cp commande do not say avything about that?

thanks for help
Jakez

Exclude the links of the list to copy :
ksh
cd dty
for file in $(find . ! -type l)
do
cp -pr $file backup_dty
done

In case you want a tool for backup try rsync :www.samba.org/rsync)

hello guy,

  • thanks for replying

  • i tried your script but if we have a link in the dty to copy the dty which is pointed to by the link is copied also !! even when executing the cmde: "find . ! -type l" when we are in the dty to copy the link does not appear !!!!

  • where is the error?
    jakez

Sorry I missed the first line returned by the find command (the dot)
The following code should work:
ksh
cd dty
for file in $(ls)
do
[ ! -h "$file" ] && cp -pr "$file" bkp_dty
done

Hi chap,

  • the last script you gave me makes again the copy of the symbolic link (he type "l" file listed by ls

  • some idea for not copying the link??

thanks a lot
Jakez

have a look at:
find ./ ! -follow | cpio -pdmuv /new/directory

greetings pressy

Hi pressy,

  • what do you mean with 'follow' in your cmde:
    find ./ ! -follow | cpio -pdmuv /new/directory

thanks
Jakez

hi again,

FOLLOW is a parameter of the find programm, it says that you FOLLOW the links, it is always set to true. so you need the "!". it negates the parameter, so " ! -follow" means: do not follow links...

i think "man find" sould help you....