In Perl, I do a:
rmtree($myfolder);
Often this fails on windows. When ran again, it then succeeds. It seems like somehow it takes a while to delete the files in the folder, and somehow it tries to delete the folder before the files are gone.
Is there a "this one actually works" Perl method to erase an directory with all its contents on Windows?