1 year ago

#360979

test-img

Yosif Chumpov

FileSystemWatcher Created event not firing for files that has been moved from zip archive

I have a very simple scenario where FSW just doesn't work. I use code like that to setup the watcher:

private FileSystemWatcher watcher = new FileSystemWatcher(@"folderToListenForChanges"))

private void Listen(){ 
            watcher.IncludeSubdirectories = true;
            watcher.NotifyFilter =
                NotifyFilters.FileName |
                NotifyFilters.DirectoryName |
                NotifyFilters.LastWrite |
                NotifyFilters.Security |
                NotifyFilters.CreationTime |
                NotifyFilters.LastAccess |
                NotifyFilters.Attributes |
                NotifyFilters.Size;
            watcher.Filter = "*.*";
            watcher.Created += Watcher_Created;
            watcher.Renamed += Watcher_Renamed;
            watcher.Deleted += Watcher_Deleted;
            watcher.Error += Watcher_Error;
            watcher.Changed += Watcher_Changed;

            watcher.EnableRaisingEvents = true;
        }
    }

Let say that there is a zip archive containing single file and folder similar to this one:

Some Dir \ some file.txt

The zip archive is outside "folderToListenForChanges". The thing is that when I open this archive with 7zip and use drag&drop to copy the "Some Dir" folder of the archive into the "folderToListenForChanges", FSW fire event only for directory creation but NOT for file creation. Any ideas?

c#

events

drag-and-drop

7zip

filesystemwatcher

0 Answers

Your Answer

Accepted video resources