I am also having a problem with the program trying to delete the actual 'foo' directory.
Is there any chance you're in the directory
while trying to run the script?
Unlike UNIX,
Win32 won't allow a directory to be deleted
when someone has cd'ed to the directory.
I never get used to this...