Und wieso lässt du das nicht Windows mit
MoveFileEx für dich erledigen?
Zitat:
If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.
Windows Vista - Eine neue Erfahrung in Fehlern.