in reply to Re: deleting directory named -I (as Ice).
in thread deleting directory named -I (as Ice).

No, no, no. unlink is for files. rmdir is for directories. Neither of them can substitute for the other.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: Re: deleting directory named -I (as Ice).

Replies are listed 'Best First'.
Re: ?Re: Re: deleting directory named -I (as Ice).
by JSchmitz (Canon) on May 21, 2002 at 21:26 UTC
    from the docs...

    unlink LIST
    unlink Deletes a list of files. Returns the number of files successfully deleted.

    $cnt = unlink 'a', 'b', 'c';
    unlink @goners;
    unlink <*.bak>;

    "unlink" will not delete directories unless
    you are superuser and the -U flag is supplied to
    Perl. Even if these conditions are met, be warned
    that unlinking a directory can inflict damage on
    your filesystem. Use "rmdir" instead.

    If LIST is omitted, uses "$_".
      Strictly speacking you can use unlink to delete directories but it works differently than rmdir. For example you can unlink directory which has some files in it and it likely to leave you with corrupted filesystem but you cannot do same with rmdir which will just fail in this case.

      --
      Ilya Martynov (http://martynov.org/)