0

I was seeing if I could use python to delete a file upon reboot. I am only able to rename it at reboot, I can't figure out the syntax to set the destination to null. Below is what works to rename the file

import win32file
import win32api

win32file.MoveFileEx("test.txt", "test2.txt" , win32file.MOVEFILE_DELAY_UNTIL_REBOOT)

how can I set the destination to null, to delete upon reboot?

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by vegaseat
0

I used the method from win32api instead of win32file and this works

win32api.MoveFileEx("file", None, win32con.MOVEFILE_DELAY_UNTIL_REBOOT)
0

Great that you figured it out. I checked the win api help, and the only thing I came up with was a possible problem with the win api NULL and Python's None. It looks like there is no problem there!

Nice to see you still active with Python!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.