.net에서 FileSystemWatcher을 사용할 수 있습니다. 마지막 액세스 시간의 변경을 감지하는 Changed 이벤트에 대한 핸들러를 추가해야합니다 (다른 것들 중에서). 위의 링크 된 MSDN 예제에서
는 :
public static void Foo()
{
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = @"Your path";
/* Watch for changes in LastAccess time */
watcher.NotifyFilter = NotifyFilters.LastAccess;
// Only watch text files.
watcher.Filter = "*.txt";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
// Begin watching.
watcher.EnableRaisingEvents = true;
}
private static void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
}
이미 앱이 마지막 액세스 시간을 변경하지 않는 것을 시도했다. 그래서 그것은 그런 식으로 발견 될 수 없습니다. – blez
읽기 파일을 잠급니까? –
아니요, 그렇지 않습니다. – blez