In my computer, structure of folder that contains multiple source file is as follow:
D:\test\interfaces\codex\A\
D:\test\interfaces\codex\B\
D:\test\sources\code\X
D:\test\sources\code\Y
D:\test\boot\M\
D:\test\boot\N\
I want to count all sources files in subfoler A,B,X,Y,Z. I realize that these subfolders belong to folder "code" and "codex". Therefore, I use this command line:
cloc --by-file --force-lang-def=filter.txt --skip-uniqueness --match-d='/(code|codex)/' --exclude-dir=boot "D:\test" --out=count.txt
However, it does NOT work. I did not find any source files to count. It returns:
0 text files
0 unique files
0 files ignored
When I try to find source code in one folder only (for exampale: code), using regular expression, it still did NOT work:
cloc --by-file --force-lang-def=filter.txt --skip-uniqueness --match-d='/code/' --exclude-dir=boot "D:\test" --out=count.txt
But if I change to following one (NOT use regular expression), it works for me:
cloc --by-file --force-lang-def=filter.txt --skip-uniqueness --match-d=code --exclude-dir=boot "D:\test" --out=count.txt
Could you please helping me to solve this problem? Thank you.
Anonymous
I duplicated your directory tree on a Linux machine and found this works:
so try removing the /'s from your --match-d regex as the code is looking for those. Also, you might hit problems in the future if you put optional arguments after the directory names to work on. In other words, instead of
put the input directory, D:\test, last: