Microsoft MVP성태의 닷넷 이야기
fileSystemWatcher 이벤트 관련 질문입니다 [링크 복사], [링크+제목 복사],
조회: 12602
글쓴 사람
guest
홈페이지
첨부 파일
 

우문현답에 감사드리며
1.0.0.0 폴더에 test.txt 파일을 삭제 시도 시 MessageBox.Show("경고")를 띄우려하는데
안되네요 ㅜㅜ



   private FileSystemWatcher _fileSystemWatcher;
       

        private void Run_Watcher()
        {
            _fileSystemWatcher = new FileSystemWatcher(Application.LocalUserAppDataPath);
            

            _fileSystemWatcher.NotifyFilter = NotifyFilters.Attributes
                                 | NotifyFilters.CreationTime
                                 | NotifyFilters.DirectoryName
                                 | NotifyFilters.FileName
                                 | NotifyFilters.LastAccess
                                 | NotifyFilters.LastWrite
                                 | NotifyFilters.Security
                                 | NotifyFilters.Size;

            _fileSystemWatcher.Changed += OnChanged;
            _fileSystemWatcher.Created += OnCreated;
            _fileSystemWatcher.Deleted += OnDeleted;
            _fileSystemWatcher.Renamed += OnRenamed;
            _fileSystemWatcher.Error += OnError;

            _fileSystemWatcher.Filter = "*.txt";
            _fileSystemWatcher.IncludeSubdirectories = true;
            _fileSystemWatcher.EnableRaisingEvents = true;
        }
        private void btnFeileEvent_Click(object sender, EventArgs e)
        {
            Run_Watcher();
        }
        private static void OnDeleted(object sender, FileSystemEventArgs e)
        {
            
            MessageBox.Show("OnDeleted: " + e.FullPath);
        }








[최초 등록일: ]
[최종 수정일: 4/18/2023]


비밀번호

댓글 작성자
 



2023-04-18 07시50분
c:\temp 디렉터리로 해놓고 테스트해도 마찬가지인가요? 딱히 안 될 이유가 없는데요, Application.LocalUserAppDataPath 경로를 출력해 보시고 정확히 그 디렉터리에서 테스트한 것인지 확인해 보세요.
정성태
2023-04-18 07시56분
[guest] 이렇게 빨리 감사드립니다^^; 항상 대안을 제시해주시네요 c:\temp
[guest]

... 61  62  63  64  [65]  66  67  68  69  70  71  72  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
981김창욱7/11/201121221주식형태의 프로그램 처럼 SQL서버의 특정 필드 데이터의 변화가 있을때 재 클라이언트가 정보를 갱신 할 수 있게 하는 방법은 없을까요? [2]
980YJ7/7/201120975App Pool idle time 과 WCF 서비스의 비동기 function 호출. [3]
979왕초보7/1/201119262Apache + IIS Redirect [2]
9776/16/201123185웹컨트롤 어느거 쓰는게 좋나요 [1]
976박성준6/13/201118700VS2008 Add-in 구현 관련 질문 [4]
972김길6/6/201120958메모리 해제 예외 처리 관련.. [2]
971강동원5/29/201118496firebird install건 [1]
970임동찬5/18/201119280ASP.net 솔루션 디버깅 관련 [1]
969이성환5/4/201120940WMI 를 사용하지 않고 하드웨어 정보를 가져올 수 없을까요? [3]
968김동미4/28/201120368안녕하세요 다시 한번 문의를 드립니다.. [2]파일 다운로드1
967임동찬4/22/201123057C# using문 관련 [9]
964김동미4/18/201120688wcf IsOneWay 속성관련 문의 입니다..
965정성태4/18/201121993    답변글 [답변]: wcf IsOneWay 속성관련 문의 입니다..
966김동미4/19/201119600        답변글 [답변]: [답변]: wcf IsOneWay 속성관련 문의 입니다.. [1]
963최재훈4/12/201118260wcf inactivityTimeout 설정시 문의 사항이 있습니다. [2]
962임동찬4/8/201117914TFS 사용관련 [1]
961임동찬4/7/201118218XSD & XML & XmlCodeGenerator [2]
960임동찬4/5/201119906XML Schema Editor [4]
959immm3/24/201117671로그인 연동 어려운 건가요? [1]
958꼭지3/3/201119777Supporting compressed request in WCF 3.5 [5]
957임동찬2/21/201120210WCF channel faulted 관련 [2]
956윤용한2/18/201123679WaitHandle.WaitOne 과 Stopwatch에 관한 질문 [3]
955최광욱2/17/201120361TFS 에서 소스 영구 제거 방법 [1]
954한장우2/16/201118032atl activeX 질문이요~ [1]
952박용운2/16/201118910IE8.0에서 BHO [1]
953박용운2/16/201118856    답변글 [답변]: IE8.0에서 BHO
... 61  62  63  64  [65]  66  67  68  69  70  71  72  73  74  75  ...