file size in macro

Posted by Bruno on
URL: http://imagej.273.s1.nabble.com/file-size-in-macro-tp5009601.html

Hi,

I wrote a macro that list files in a directory if the file size is less than some number.
This does not seem to work if the size is e.g. 10000 but does work for 9999 .. ?

dir = getDirectory("Choose a Directory ");
list = getFileList(dir);
print("Number of files: "+ list.length);
j=0;
for (i=0; i<list.length; i++) {
        path = dir+list[i];
// if(File.length(path) < 10000) { //exclude long files ... does not work
        if(File.length(path) < 9999) { //exclude long files ... does work
                print(File.length(path) + " " + i + " " + list[i]);
                j=j+1;
        }
}
print("Number small files: "+ j);

What is wrong?

Bruno

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html