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

unlink. but you should be able to do in in the shell, by /usr/bin/rmdir -- -I or something.

Update: oops, merlyn's right. but you can delete from the shell (it would be a pretty bad shell if you couldn't.)

Update: after a quick read of the docs, it turns out merlyn's right in spirit, but not in fact. unlink can be used to delete directories, but it probably shouldn't. use rmdir, as both merlyn and the doc point out.

~Particle *accelerates*

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

Replies are listed 'Best First'.
•Re: Re: deleting directory named -I (as Ice).
by merlyn (Sage) on May 21, 2002 at 21:15 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/)