#!/usr/bin/perl -w use File::Path; use File::Basename; # This extracts the path of the current directory into # the variable $dirname my $dirname = dirname($0); # The following line (beginning with the word "rmtree") is # commented for safety purposes. It WILL delete the # contents of the directory the script is in, and all it's # subdirs. I did test it, but please do not take my word # for it! Try it in your temp dir before putting this in # with your live data. # Uncommenting this line will cause files to be deleted! # rmtree([$dirname], 1, 1); print "This is a drill. If this were not a drill, the dir '$dirname', and all of it's contents and subdirectories would be toast right now.";