A caution: never do this for a file that may be open (by the current process or by any other). Some platforms (cygwin on older windows, in particular) may internally
schedule a deferred deletion of 'foo' and return true if
unable to immediately delete it. This creates an endless loop.
The 1 while unlink idiom is documented here.