in reply to Re: using NT - rmdir cmd to purge aged NT folders
in thread using NT - rmdir cmd to purge aged NT folders

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.