$ mkdir foo $ touch foo/bar $ chmod 444 foo/bar $ perl -e 'use File::Path "rmtree"; rmtree("foo", 0, 1)' Can't remove directory foo: Directory not empty at -e line 1 $ ls foo bar