How to consistently scan for a text file (or any file)?

조회 수: 2 (최근 30일)
Tamfor Dulin
Tamfor Dulin 2015년 2월 10일
편집: Tamfor Dulin 2015년 2월 11일
So I wanted my app to scan a text file consistently... So that it will update according to what the file has soon as the file is in that specific directory. How is that possible?? Because I have no clue what is the function for that.

채택된 답변

per isakson
per isakson 2015년 2월 10일
편집: per isakson 2015년 2월 10일
"soon as the file is in that specific directory" &nbsp See: Monitor Changes to .TXT File
Create a FileSystemWatcher object fileObj and watch the Changed event for files
with a .txt extension in the folder C:\work\temp.
fileObj = System.IO.FileSystemWatcher('c:\work\temp');
fileObj.Filter = '*.txt';
fileObj.EnableRaisingEvents = true;
addlistener(fileObj,'Changed',@eventhandlerChanged);
"scan a text file consistently" &nbsp what exactly do you want to do. Read the file and search for specific content?
  댓글 수: 1
Tamfor Dulin
Tamfor Dulin 2015년 2월 11일
편집: Tamfor Dulin 2015년 2월 11일
Thanks alot What you told me is exactly what I needed. I can do the rest...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by