File::Path removes everything. Not just non-empty directories.
savanm...
While it is the inverted answer, you are running rmdir on EVERY filename, not just directories or even empty directories. Though That is quite valid as it does the required tests.
Now to try and answer for real...
To try and remove directories that are NOT empty, is tricky. A directory with a directory is technically not-empty. So by that criteria, you want to remove any directory that is more than 2 levels deep! That does not sound right.
So what exactly do you want?
Delete directories that contain files? Or just...
Delete all files and leave just the directory structure?
Comment