We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to show a list of all files within a directory as well as sub directories

How Do I?

Torch's avatar
Torch
37 posts
one year ago
Torch's avatar Torch

I’m using the native file manager. I have a folder the has multiple sub directories within it and files. I want to show a list of all files, as well as organize them to what directory they’re in. Basically showing the same structure on the front-end as the file directory structure in EE.

I’m running 7.3.15.

{exp:file:entries limit="100" paginate="both" directory_id="11"  dynamic="no" sort="desc"}
<strong><a href="http://{file_url}" target="_blank" rel="noopener">{title}</a></strong>

{directory_title}
{paginate}
        Page {current_page} of {total_pages} pages {pagination_links}
    {/paginate}
{/exp:file:entries}
       
From EE Slack's avatar
From EE Slack
185 posts
one year ago
From EE Slack's avatar From EE Slack

I’m not sure the file module can do what you’re wanting.

Is it more you want to show the directory structure?

blog – blog_news – blog_code

Where the above are folders/subfolders? And maybe show the entries in each folder as well?

The file entries tag is going to show the individual files. It can show their directory info, but I don’t think you can get from the entries to the directory structure. Not in any way I’d want to try and do with the tags.

But- am I understanding what you’re going for or totally in left field?

       
Torch's avatar
Torch
37 posts
one year ago
Torch's avatar Torch

I actually got what i wanted by using this code with the Assets Add-on. Not sure the file module is capable.

<ul>
    {exp:assets:folders}
        <li>
            <h1> {folder_name} </h1>
            {if total_subfolders > 0}
                {exp:assets:files folder_id="{folder_id}"}
                {url}
                {/exp:assets:files}
                <ul>
                    {subfolders}
                </ul>
            {/if}
           
            {if total_subfolders == 0}
                {exp:assets:files folder_id="{folder_id}"}
                      {url}
               {/exp:assets:files}
            {/if}


        </li>
    {/exp:assets:folders}
</ul>
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.