help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting number of files in a folder


From: David Bateman
Subject: Re: Getting number of files in a folder
Date: Wed, 17 Mar 2010 22:19:59 +0100
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)

Journeaux, Ian wrote:
I would like to get the number of files in a folder (The files are of the form 
file0001.txt) so I can loop through each one of the files.

Is there a way to do this within Octave?
This electronic message contains information from NewPage Corporation or subsidiary companies, which may be confidential, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify NewPage immediately at address@hidden
There are probably lots of ways of doing it but

length (dir()) - 2

should be a good means. The minus 2 is needed to exclude the pseudo directories "." and "..", though I can't remember if these appear under a version of Octave on windows, so perhaps you need to drop the "-2" in that case or do something like

len = length(dir())
if (!ispc())
 len -= 2;
endif

D.

len = length


reply via email to

[Prev in Thread] Current Thread [Next in Thread]