Login  Register

Re: getFileList(dir) includes "Thumbs.db" in Window XP

Posted by dscho on Jul 14, 2011; 3:51pm
URL: http://imagej.273.s1.nabble.com/getFileList-dir-includes-Thumbs-db-in-Window-XP-tp3683925p3683927.html

Hi Soon Yew (hope I got that correctly),

On Thu, 14 Jul 2011, Lim Soon Yew wrote:

> When I am running the built-in macro function getFileList(dir) in Window
> XP, it includes the "Thumbs.db" file generated by Window XP. But when I
> run the same macro in Window 7, it gives me the right number of files
> and does not include any "Thumbs.db" file.

Windows 7 probably marks the Thumbs.db file as hidden by default, that is
my guess. I am working around issues like these by doing something like

        list = getFileList(dir);
        for (i = 0; i < list.length; i++)
                if (list[i] != "Thumbs.db")
                        ...

Quite often, I already know the desired file extension, in which case I
can use something like "if (endsWith(list[i], ".png"))" instead, which is
even more specific.

Ciao,
Johannes