------------------------------------------------ On Wed, 1 Oct 2003 15:54:25 -0400, "Paul Kraus" <[EMAIL PROTECTED]> wrote:
> I need to do recursive deletes. But according to perldoc I should not > use unlink. I should use rmdir. However rmdir does not work unless the > directory is empty.... Should I just system rm -r .... > > > >From perldoc > 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 `$_'. > bash-2.03$ perldoc -f rmdir > rmdir FILENAME > > rmdir Deletes the directory specified by FILENAME if > that directory is empty. If it succeeds it > returns true, otherwise it returns false and sets > `$!' (errno). If FILENAME is omitted, uses `$_'. > Why you shouldn't is probably a bit low level, check on how unix file systems are built, etc. for more info if you want it. Probably the best description of it that I have seen was in teh Practical Unix and Internet Security book from ORA. As to your Perl issue, have a look at: perldoc File::Path Specifically the 'rmtree' function, I think you will be pleased... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]