Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Perl Monks, Handling of soft links when the contents of the directory (links + files + subdirectories) are copied into another directory. i am able to copy the files & subdirectories into another directory but i dont know how to copy the link as the path of the link changes. before copying, add_d -> /home/operation/test/oper1/ now if the directory is changed to id1 add_d -> /home/operation/test/oper1/id1 I am working on clearcase project .i have not shown creating of directories & copying of the clearcase files. i have pasted only that part of the code which involves copying of link files.
my $desti_dir = $ARGV[0] ; # destination directory. my @list_view_pri = ClearCase::CtCmd::exec("ls -view_only"); my @viewPri = split("\n",$list_view_pri[1]); foreach my $view (@viewPri) { if(-l $view) { my $where = readlink("$view"); my $dir = $where."/$desti_dir " symlink($view,$dir) || die "Cannot symlink"; } else { system("mv $view $desti_dir"); #move other files }

Replies are listed 'Best First'.
Re: handling of soft links
by fmerges (Chaplain) on Jul 26, 2006 at 11:21 UTC