looping through folders / subfolders

Upload Adobe Bridge Scripts, Download Adobe Bridge Scripts, Support for Individual Adobe Bridge Scripts

Moderators: Tom, Kukurykus

tms

looping through folders / subfolders

Post 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.
jacobolus

looping through folders / subfolders

Post 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.