Windows 7 appears to be losing changes made to text files if the PC loses power, even if the changes have been saved. Why would it be doing this and how can I make the changes stick? I need the changes to be persistent even if there is a power failure.
I did all sorts of testing with opening, modifying, saving, etc. text files (specifically, a configuration file with pieces of data on each line) in combination with shutting down properly and unplugging the PC in different orders and it looks like the following patterns emerged:
- text files can be opened and viewed only and the PC shut down properly OR lose power and the file is OK
- text files can be opened, modified and saved and the PC shut down properly and the file is OK
- text files are opened, modified (change a line of data) and saved via notepad and the PC loses power (i.e. unplug it, not shut down properly) and when it powers back up the file is still there but the changes are gone.
- If the file is modified by the software that uses it (which completely rewrites it) and there is a power failure, when it comes back up the file only consists of a bunch of "space" characters all one one line.
- One time I deleted all lines of data and re-wrote the file manually via notepad and unplugged it and when it powered back up the first 70% or so of the file was there but the end was gone.
- If the text file is modified and then I wait for a period (5 minutes) and there is a power failure (unplug), when it starts back up, the text file is fine and the changes are intact.
So, I guess that every so often Windows does something that makes the changes permanent and this same thing happens during shut-down and whatever this thing is that it does gets skipped/missed if there is a power failure shortly after the changes are made. Is that correct?
What is the thing that it is doing that makes the changes permanent (it's obviously not simply the act of saving the file)? How often does it occur? Is it possible to make it occur more often?