in reply to Re: Re: unlink Question
in thread unlink Question
from perldoc -f
unlink LIST
unlink Deletes a list of files. Returns the number of files
successfully deleted.
$cnt = unlink 'a', 'b', 'c';
unlink @goners;
unlink <*.bak>;
Note: "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 $_.
from perlportDon't unlink or rename an open file.
Don't assume that a single unlink completely gets rid of the file: some filesystems (most notably the ones in VMS) have versioned filesystems, and unlink() removes only the most recent one (it doesn't remove all the versions because by default the native tools on those platforms remove just the most recent version, too). The portable idiom to remove all the versions of a file is
1 while unlink "file";This will terminate if the file is undeleteable for some reason (protected, not there, and so on).
Some operating systems don't have links at all.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: unlink Question
by sauoq (Abbot) on Nov 11, 2003 at 20:08 UTC |