use File::Path 'remove_tree'; remove_tree('path/to/directory');