pywin32 MovefileEx

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Solved Threads: 16
shanenin shanenin is offline Offline
Posting Whiz in Training

pywin32 MovefileEx

 
0
  #1
Jun 20th, 2006
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
  1. import win32file
  2. import win32api
  3.  
  4. win32file.MoveFileEx("test.txt", "test2.txt" , win32file.MOVEFILE_DELAY_UNTIL_REBOOT)

how can I set the destination to null, to delete upon reboot?
In a perfect world exceptions would not be needed.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Solved Threads: 16
shanenin shanenin is offline Offline
Posting Whiz in Training

Re: pywin32 MovefileEx

 
0
  #2
Jun 21st, 2006
I used the method from win32api instead of win32file and this works
  1. win32api.MoveFileEx("file", None, win32con.MOVEFILE_DELAY_UNTIL_REBOOT)
In a perfect world exceptions would not be needed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,042
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 933
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: pywin32 MovefileEx

 
0
  #3
Jun 21st, 2006
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!
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC