I have to admit -- I've never tried this particular task before, but I found it most amusing to build. Perhaps it was the danger that if I did it incorrectly I'd end up without my home directory or something like that :-)
However, I'm happy to announce that this code is tested, it does work, and I'll describe what it does so you know what you're getting yourself into :-)
#!/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
+.";
Update: Code has been removed until the original posted states why they want it.. while there are many legitimate reasons for this, there are also plenty of malicious ones.
Update 2: The original poster has posted a very legitimate reason for requiring this functionality. So without further ado, I have re-posted this code. I appologize for the delay, but unfortunatly not everyone is honest these days. Good luck!
-Eric