cloc

Is it possible to get --exclude-ext work only for some specific directories?


I need to exclude *.c files only from some specific directory/sub_directory. Is this possible?


Solution

  • cloc does not have a built-in way to do that. You can exclude all *.c, or exclude a specific dir/subdir, but not exclude *.c only within a dir/subdir.

    A two-step solution comes to mind: you can make a list of files you want to exclude then pass that list file in to cloc with --exclude-list-file, for example,

        find dir/subdir -type f -name "*.c" > dont_want_these.txt
        cloc --exclude-list-file dont_want_these.txt dir