1

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

-Assets
--Dept_A
---Jan15
--Dept_B
---Jan15
---Jan16

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.