Counting Files in a Directory

/ Published in: PHP
Save to your folder(s)

To find the count of number of files in a directory, use this.

Copy this code and paste it in your HTML
  1. <?php
  2. $dir_path = "wp-content/uploads/media/";
  3. $wcount = count(glob("" .$dir_path. "*.jpg"));
  4. ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.