check a folder every 10 sec

1 view (last 30 days)
Andrew
Andrew on 20 Jun 2013
clc
if Num<5
display (wait)
D = dir(['C:\s', '\*.txt']);
Num = length(D(not([D.isdir])))
else display (ok).
end
how can i check the folder C:\s every 10 sec and when the number of txt files are 5 to stop?....something like the above code....thank you....

Accepted Answer

the cyclist
the cyclist on 20 Jun 2013
D = dir(['C:\s', '\*.txt']);
Num = length(D(not([D.isdir])));
while Num < 5
D = dir(['C:\s', '\*.txt']);
Num = length(D(not([D.isdir])));
pause(10)
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!