Page 1 of 1

looping through folders / subfolders

Posted: Sun Aug 05, 2012 2:47 pm
by tms
Hi,

I'm about to create a script to check some tifs and jpgs for the right height and width, resolution and so on.
I could get it to work if I see the files in the content panel (looping through the files by app.document.getSelection ...

The script needs to check many files in different subfolders (all in one parent folder), so I don't like to use a collection to reveal all files of all subfolders first and then start the script.

My plan is to choose the parent folder in the folder panel and the script should loop through each file of each subfolder ...

So maybe there's someone who knows a solution for this problem, it would be great!

Thanks a lot,
Sebastian.

looping through folders / subfolders

Posted: Mon Aug 06, 2012 3:56 am
by jacobolus
Take a look at the ExtendScript Toolkit’s “JavaScript Tools Guide” document, under the third chapter, “File System Access”. If you make a Folder object for your desired directory, you can get an array of File and Folder objects inside it using the getFiles() method. You can loop through it like any other JavaScript array.