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

Hi my fellow monks I have a Linux library which includes files and links.
I would like to delete only the links, without deleting the files.
Is there a way to check if i'm dealing with a link or a file ?
thanks

Replies are listed 'Best First'.
Re: deleting links but not files
by broquaint (Abbot) on Jun 03, 2003 at 15:14 UTC
    Is there a way to check if i'm dealing with a link or a file ?
    Sure is, just check with -l e.g
    print "yup, it's a link" if -l $filename;

    HTH

    _________
    broquaint

      Thanks !!!
Re: deleting links but not files
by CukiMnstr (Deacon) on Jun 03, 2003 at 15:19 UTC
    You want to take a look at the file test operators ("-X" in perlfunc). -l returns true if the file is a symbolic link.

    hope this helps,