0

Is there a way to count how many files in a specific directory are over some file size? Say, 100 MB?

Travis Tiner
  • 13
  • 1
  • 2
  • 1
    Combined with https://unix.stackexchange.com/questions/4105/how-do-i-count-all-the-files-recursively-through-directories – muru Jul 13 '19 at 03:00
  • Related:  [How can I count the files in a directory using the command line?](/q/1125/23408), [How to count recursively the number of files in several directories?](/q/70993/23408), [Script to count files matching a pattern in subdirectories](/q/27389/23408), [How to use wc and piping to find how many files and directories are in a certain directory?](/q/101415/23408), [Reporting number of files in subdirectories](/q/500417/23408), [Number of folders in a directory (recursive)](/q/167228/23408), [No of files and directories in a particular directory in shell script](/q/200293/23408), etc. – Scott - Слава Україні Jul 13 '19 at 09:01

1 Answers1

3

Perhaps

find path/to/directory/ -type f -size +100M -printf 1 | wc -c

Or, if you want to limit the search to the top level directory only (without descending into subdirectories)

find path/to/directory/ -maxdepth 1 -type f -size +100M -printf 1 | wc -c
steeldriver
  • 78,509
  • 12
  • 109
  • 152