develooper Front page | perl.beginners | Postings from February 2002

Re:How to delete a symlink

Thread Next
From:
Jorge Goncalvez
Date:
February 6, 2002 01:09
Subject:
Re:How to delete a symlink
Message ID:
200202060909.KAA20992@cabs40.col.bsf.alcatel.fr
Hi, I wanted to verify if a symlink exists  and delete it if it exists
My code is:
my $program_path = "c:\\cygwin\\bootp\\linux";
my @program = (
        "$program_path\\$_Globals{LX_VERSION}",
        "$program_path\\install",
        "$program_path\\linux.ram",
        "$program_path\\alize\\install",
        "$program_path\\alize\\startup.txt"
 );

	my $link_prefix = "c:\\cygwin\\bin\\ln.exe -s
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Gl
obals{LX_VERSION}";
my @link = (
        "$link_prefix",
        "$link_prefix\\install",
        "$link_prefix\\linux.ram",
        "$link_prefix\\install",
        "$link_prefix\\alize\\startup.txt"
 );


my @pairs;
push @pairs,
    {  link => "$link[$_] $program[$_]",
      program => $program[$_] }
                                foreach 0 .. $#link;

foreach my $p ( @pairs ) {
    system($p->{link} ) unless -e $p->{program};
}


In fact i wanted to delete :
"$program_path\\install",
        "$program_path\\linux.ram",
        "$program_path\\alize\\install",
        "$program_path\\alize\\startup.txt"
        
  if they already exists to make new one with the new destination.
  
  Thanks.      


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About