Johannes,
On Wed, 2008-08-27 at 17:32 +0200, Johannes Breu wrote:
> I have a folder called IMAGES. Within this folder there are subfolders
> called FOLDER1, FOLDER2 etc. I wish to open IMAGES and the subfolders
> FOLDER1, FOLDER2 in batch mode so that all images are processed
> successively. I cannot find a code in under the macro location that works
> that way. In addition I wish to get the name of FOLDER1, FOLDER2 for further
> renaming results.
> 
> 
> So far I always opened each FOLDER1 by following code:
> 
> dir1 = getDirectory("Choose SOURCE Directory ");
>    list = getFileList(dir1);
>    setBatchMode(true);
>    for (i=0; i<list.length; i++) {
>       showProgress(i+1, list.length);
>       open(dir1+list[i]);
> 
>        t=getTitle();
> }
from 
http://rsb.info.nih.gov/ij/macros/ListFilesRecursively.txt :
dir = getDirectory("Choose a Directory ");
count = 1;
listFiles(dir); 
function listFiles(dir) {
        list = getFileList(dir);
        for (i=0; i<list.length; i++) {
        if (endsWith(list[i], "/"))
                listFiles(""+dir+list[i]);
        else
                print((count++) + ": " + dir + list[i]);
        }
}
Of course, instead of just counting you can do whatever you want in the
else branch of the if conditional, effectively recursing over all files
in subdirectories of dir.
HTH,
-Stefan