Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37677

Re: Count Files in Folders

$
0
0
by howard b.  

Thanks that's great. I get the following error message though:

Can not find data record in database table course_modules.

 

                    $folder = $DB->get_records_sql("SELECT {folder}.id FROM {folder} WHERE course = '$courseid'");
                    $count = 0;
                    $folders = 0;
                    foreach ($folder as $fo){
                    //files within folders
                    $cm = get_coursemodule_from_id('folder', $fo->id);
                    $context = context_module::instance($cm->id);
                    $contextid = $context->id;
                    $files = $fs->get_area_files($contextid, 'mod_folder', 'content', false, '', false);
                    $folders += count($files);
                    }

 

Your help is greatly appreciated.


Viewing all articles
Browse latest Browse all 37677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>