Running cpplint on all .cpp files

795 Views Asked by At

I want to run cpplint.py on all my .cpp files in a folder in Windows CMD.

py .\cpplint.py *.cpp

This somehow doesn't work. I get the Error:

Skipping input '*.cpp': Can't open for reading
Total errors found: 0

I thought * would be the operator for select all, am I wrong?

P.S.: There's a similar post, but it didn't really help.

2

There are 2 best solutions below

0
On

In a batch file or from the command line you can do:

for %%f in (*.cpp) do py .\cpplint.py %%f
0
On

Windows' CMD doesn't do wildcard expansion: https://superuser.com/questions/460598/is-there-any-way-to-get-the-windows-cmd-shell-to-expand-wildcard-paths

It's up to the application to handle the expansion of * into paths on Windows, which is in stark contrast to Linux, where the shell itself handles that. So you're passing the string-literal * to cpplint.py, which is not a file.