in reply to Find Empty directories and removing it
Just remove them. If they're not empty, rmdir will fail. In this case, you don't care that it fails, ignore the error, and keep going.
use File::Find; finddepth(sub { rmdir $_ if -d }, $some_path);
Update: added 'depth' as per merlyn's correction.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find Empty directories and removing it
by merlyn (Sage) on Jan 04, 2006 at 05:33 UTC |