For each file, the file name extension should indicate a file type, such as
. jpg indicates that this is a JPG file that can be verified in the format of the JPG file;
But often, for example, from a Web application, like to mess up an extension, such as
. tmp. DAT, etc., although it may be a JPG file, but it can not be verified according to the extension;
This is a dilemma:
1, if regardless of file extension, directly according to the file header to determine the file type, this is a check method;
But
2, if the. tmp file is deleted, its location is just another JPG file (if the jpg file is also deleted), then the confusion of the two files, to restore the JPG file is difficult.
How should I choose a recovery algorithm?
Perhaps should not consider the 2, only according to one to do, the probability of success is greater, far greater than the consideration of 2.
Algorithmic thinking: Checking for deleted files