Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code, is there a way to count the files by type? say I need to count the "ts" files in my project

In my huge project, I would like to count the ".ts" file(s) existence. as well ".spec.ts" files. how to I count them separately. is there a way in "visual studio code" for it? simply counting the file by it's extension.

at present I am trying with "ctl + shif+ f" but not works.

thanks in advance.

like image 507
3gwebtrain Avatar asked Nov 04 '25 20:11

3gwebtrain


1 Answers

Ctl-Shift-F is a good enough approach, if the total amount of files that you will potentially match is less than 10000. This is due to a limitation in vscode, that limits the total amount of matches to this number. Thanks to @Timothy G for pointing this out!

I would do it like this:

To count all .spec.ts files change the search pattern to regex and search for (.*\n?)* (this matches the whole content of the file, forcing a multi-line match in vscode).

Under "files to include" add *.spec.ts:

enter image description here

To count all *.ts files without the *.spec.ts files you set "files to include" to *.ts and "files to exclude" to *.spec.ts:

enter image description here

like image 155
Manuel Batsching Avatar answered Nov 07 '25 11:11

Manuel Batsching



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!