MATLAB Answers

Andrew
0

check a folder every 10 sec

Asked by 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....

  0 Comments

Products

No products are associated with this question.

1 Answer

Answer by the cyclist
on 20 Jun 2013
 Accepted answer

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

  1 Comment

thank you!


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!