I'm working with images in subfolders, several levels deep, under the Assets parent folder.


I've come across this code (below), but it only will find the parent ("Assets") and the children ("Dept_A" and "Dept_B").
I want to loop through all of the subfolders, if possible. Thanks for any leads.

foreach ($assetSources as $source)
        $folder = craft()->assets->findFolder(array(
            'sourceId' => $source->id,
            'parentId' => ':empty:'

        $subfolders = craft()->assets->findFolders(array(
            'parentId' => $folder->id

        $foldersBySource[$source->id] = $folder;
        $subfoldersBySource[$source->id] = $subfolders;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.