Programs that index file systems seem to know which parts have changed since their last index, and only re-scan that part. How to determine where the file system / files has changed since my last index. I don't care what language you answer, but I think c and windows.
An example of such a program is Sequoia View, which generates a treemap of your hard drive.
A fairly simple method is to take the size of files registered in the file system, dates (as integer values) and file names in a given directory and calculate checksum , you can then link to this directory. You will still need to perform this calculation in all directories using the file system data, but you will not need to go deeper (opening files to check for differences) if the checksum did not report the differences.
To track specific changes at the file level, you must store checksums based on individual file attributes, as well as, of course, the presence or absence of files and subdirectories since the last scan.
, , , .
fswatch .
.Net- , FileSystemWatcher.
MSDN:
FileSystemWatcher . . , ., Filter ( ") (". "). , . , MyDoc.txt, " MyDoc.txt ". . , , " *.txt".
FileSystemWatcher . . , .
, Filter ( ") (". "). , . , MyDoc.txt, " MyDoc.txt ". . , , " *.txt".
2 , .
-, ( ). Windows API ReadDirectoryChangesW. - , . (... . API CAN AND WILL , , , , , .
, , , - / .
. , ( - GetFileAttributesEx) . (, "." ".." - .)
, , .. , LastAccessed.
. () .
, , . , .
, (), -, , , , .
, , , . , .
.
FindFirstChangeNotification
On Linux (and any other Unix-like OS, I suppose), it would be possible to generate a hash value for the file / folder to represent its state at a given time. Later just restore the hash and compare it to the old value. This has been very effective for some of the projects I'm working on!
Details here: http://vpalos.com/169/recursive-filedirectory-change-detection/
It is sensitive to any changes (even when changing the file access time).
Source: https://habr.com/ru/post/1698911/More articles:How to check if mod_rewrite is working - apacheHow to compile a C # file outside of App_Code? - asp.netWhat's new in Visual Studio 2008 vs 2005 or C # 3.0 vs C # 2.0? - c #Custom Collections - Still Worth the Extra Work? - performanceИспользуя код схемы для решения квадратного уравнения? - coding-styleHow to find which character set the database is using - character-encodingPython with PIL and Libjpeg on Leopard - pythonКак начать работу с Aspect Oriented Programming на платформе .NET? - c#Лучший способ избежать SQL-инъекции на сервере MSSQL из кода С# с использованием Linq? - c#Checking sorting in Selenium - sortingAll Articles