0

Within the WordPress core, I created a folder called /reports and within that directory are about 15 other folders containing .pdf's.

As an example : Core File Structure

/wp-admin
/wp-content
/wp-includes
/reports

As an example : Reports File Structure

/reports
- /folder-1
- abcdefg.pdf
- abcdefg.pdf

- /folder-2
- abcdefg.pdf
- abcdefg.pdf

- /folder-3
- abcdefg.pdf
- abcdefg.pdf

What I am trying to accomplish is to: grab that folder structure within /reports and display that same file structure on a custom template, like in a Treeview format. This is being built for the purpose of a sales team being able to quickly access this directory of reports and download the pdf file. Not 100% sure if this can be done.

Any help is appreciated!

  • How is your case specific to WP? Seems to be a more generic PHP programming question. – Rarst Sep 13 '16 at 17:57
0

This has little to do with WordPress, but anyway, in your template you can grab the directory structure with scandir:

$report_files = scandir('/reports');

Now you have array of files and folders that you can manipulate ate will.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.