in reply to using NT - rmdir cmd to purge aged NT folders

You will probably find rmtree() (part of File::Path) very useful.

Update: Sorry fglock, but unlink won't necessarily remove directories (won't at all on my NT box at least) and perldoc -f unlink tells me it's a bad choice in un*x too. You can use rmdir but that only works if the directory is empty, and that does not appear to be the case here.

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Re: Re: using NT - rmdir cmd to purge aged NT folders
by fglock (Vicar) on Aug 02, 2002 at 19:08 UTC

    The system is trying to find a program named 'rmdir /s /q'. You must write 'rmdir' instead:

     system ( 'cmd', '/c', 'rmdir', '/s', '/q', $file);

    update: use cmd /c to call the "cmd" shell, which runs rmdir for you.

    By the way, if you would delete files you could use perl's own  unlink() instead.

    update: Albannach told me that  perldoc says:

    "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.

    Use "unlink" only for deleting normal files.