상세 컨텐츠

본문 제목

FileSystemWatcher 해당 폴더의 해당 파일 감시

C#

by xarfox 2010. 7. 19. 13:38

본문


        public void filechk()
        {
            FileSystemWatcher MyFileWatcher = new FileSystemWatcher();

            MyFileWatcher.Path = @"d:\test2\exam2";  //감시할 폴더
            MyFileWatcher.Filter = "*.txt";    //필터링

            MyFileWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            MyFileWatcher.Created += new FileSystemEventHandler(OnChanged);
            MyFileWatcher.EnableRaisingEvents = true;
        }


        // Define the event handlers.
        public void OnChanged(object source, FileSystemEventArgs e)
        {

        }
       

관련글 더보기