This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients enkore, josh.r, serhiy.storchaka, xiang.zhang
Date 2016-10-31.16:37:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
You need to cache the names up front because the loop is unlinking entries, and readdir isn't consistent when the directory entries are mutated between calls.

FindFirstFile/FindNextFile likely has similar issues, even if they're not consistently seen (due to DeleteFile itself not guaranteeing deletion until the last handle to the file is closed).

scandir might save some stat calls, but you'd need to convert it from generator to list before the loop begins, which would limit the savings a bit.
Date User Action Args
2016-10-31 16:37:10josh.rsetrecipients: + josh.r, serhiy.storchaka, xiang.zhang, enkore
2016-10-31 16:37:10josh.rsetmessageid: <>
2016-10-31 16:37:10josh.rlinkissue28564 messages
2016-10-31 16:37:10josh.rcreate