in reply to Re: delete folder and its content with plain perl
in thread delete folder and its content with plain perl

The error probably has to do with the use of forward slashes in the filename, which appear to be interpreted as switches by rmdir.

I strongly recommend you use remove_tree from File::Path, as several others have suggested. It has been a core module for over 20 years and should therefore not only meet your requirement of being "plain Perl", but unlike rmdir it is also platform-independent!

Also, note that you probably don't want to use a "delete directory" function to delete individual files. See unlink for files.