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

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.

 Respuesta aceptada

per isakson
per isakson el 10 de Feb. de 2015
Editada: per isakson el 10 de Feb. de 2015
"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 comentario

Tamfor Dulin
Tamfor Dulin el 11 de Feb. de 2015
Editada: Tamfor Dulin el 11 de Feb. de 2015
Thanks alot What you told me is exactly what I needed. I can do the rest...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 10 de Feb. de 2015

Editada:

el 11 de Feb. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by