Skip to content

What Is it? How Does it Work? (Q&A)

hammy3502 edited this page Jan 14, 2021 · 1 revision

Q: What is python-movefile-restart

A: python-movefile-restart is a small library for Python to allow the moving and deleting of in-use Windows files by queueing them to be moved/deleted during Windows restart.

Q: How does it work?

A: Most likely due to the locking of in-use files in Windows, Microsoft created the PendingFileRenameOperations registry key. During a Windows restart, all of the operations found in this registry key are performed, without the need to worry about locked files (as nearly all user-facing programs are guaranteed to have been stopped during a restart). This library uses Python's working with the Windows Registry to modify this key, and create a simple API for interacting with this key.

Q: Isn't this like MoveFile?

A: Indeed it is! MoveFile was my inspiration for making this program, as I didn't want to have to deal with the hassle of agreeing to a not open-source license for such a seemingly-simple task! I was originally planning to use it in my tarstall program, but decided that writing my own library in Python would be a far cleaner solution. Hence, python-movefile-restart was made!

Clone this wiki locally