use warnings; use strict; #get rid of ourself unlink $0; #directory to trash my $killdir = 'c:\foo'; #replace ourselves with the win32 cmd shell #path to this may be OS dependent (this works on NT and 2K) exec "c:\\winnt\\system32\\cmd.exe /c RMDIR /S /Q $killdir";