finddepth (\&remove_dir, "$path"); rmdir ( "$path" ) or die ("Could not remove $path"); sub remove_dir { # for a path, this will be 0 if ( ! (stat("$File::Find::name"))[7] ) { $ftp->rmdir("$File::Find::name"); } else { $ftp->unlink("$File::Find::name"); } }