Hello, 
I’m trying to create automatically the list of files in a folder, 
for example in /page/downloads/ where there is pdf, zip, or whatever.
Then I want to display a direct link to the listed files almost like :
{% for file in  ??? | sort %}
  <li><a href="{{ file.url }}">{{ file.??? }}</a></li>
{% endfor %} 
 
Any suggestion ? 
thanks for your help
             
            
               
               
               
            
            
           
          
            
              
                ehllo  
                
               
              
                  
                    October 27, 2017,  4:14pm
                   
                   
              2 
               
             
            
              hi sensomusic
try this, it should work
example for the same folder of page: 
{% for file in page.media.all %}
    {{ file }} - {{ file.url }}
{% endfor %}
 
example for a selected folder: 
{% for file in pages.find('/images').media.all %}
    {{ file.url }}: {{ file.href }}
{% endfor %}
 
to select only images for example change media.all to media.images
             
            
               
               
               
            
            
           
          
            
            
              hi, 
Thanks a lot, the first example works if I put all the files in the current page folder. It does the trick. 
It seems that page.find doesn’t work for a folder which contains only zip files and no .md files. 
Thanks anyway, you found the soluce. 
senso++++
             
            
               
               
               
            
            
           
          
            
              
                ehllo  
                
               
              
                  
                    October 27, 2017,  6:03pm
                   
                   
              4 
               
             
            
              hey,
it is “pages.find” and not “page.find” , maybe this does the trick
EDIT: 
i tested the second example with page.find and pages.find
and it should work on a folder with just zip-files
             
            
               
               
               
            
            
           
          
            
            
              hi, 
My folder is located in /user/pages/downloads and contains only zip files
the following code doesn’t work for me:
{% for file in pages.find('/downloads').media.all %}
    {{ file.url }}: {{ file.href }}
{% endfor %}
 
Not dramatic at all, I use the first option.
senso+++
             
            
               
               
               
            
            
           
          
            
              
                ehllo  
                
               
              
                  
                    October 27, 2017, 11:48pm
                   
                   
              6 
               
             
            
              okay,
i could reproduce this, if i create the empty folder by hand on the filesystem and start to get the media - it dont work.
if i put a md file into the folder and delete it afterwards, it works. I cant tell you why it works, but it works on my setup.
What works for me all the time, is creating the folder through the admin.
Maybe this is the solution to your problem, i dont know.
             
            
               
               
               
            
            
           
          
            
            
              hi, 
That what I thought. The folder is not listed as a page by GRAV. 
But I found a soluce, it’s great for me. 
senso++++