Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am missing the wildcard character for directories. From linux I have in mind that one can define a path like this:

jslint scripts/**/*.js

which includes all js files from all descendent directories in the scripts directory tree.

jslint scripts/*/*.js

includes all direct subdirectories of scripts/.

In the windows command line this seems not to work. Is there any way to define the same?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

there isn't 'cos * or *.* in windows, lists files and directories but you can't do c:\blah\*\*

You can do

C:\tes>for /r %f in (*.mp3) do @echo mp3prog %f
mp3prog C:\tes\a.mp3
mp3prog C:\tes\mof.mp3
mp3prog C:\tes\qw.mp3
mp3prog C:\tes\y\a.mp3

C:\tes>

So you could replace *.mp3 with *.js and mp3prog with jslint that might give what you want.

And remove the @echo

Either * or *.* in those brackets works fine.

You see it lists all the commands it would execute. It goes through every file in c:\tes and all its subdirectories.

Or from any directory

C:\>for /r c:\tes %f in (*.*) do @echo mp3prog %f
mp3prog c:\tes\103.gif
mp3prog c:\tes\a.mp3
mp3prog c:\tes\mof.mp3
mp3prog c:\tes\oo.mpg
mp3prog c:\tes\qw.mp3
mp3prog c:\tes\t.mpg
mp3prog c:\tes\ta.mpg
mp3prog c:\tes\t_.mpg
mp3prog c:\tes\u.mpg
mp3prog c:\tes\uu.mpg
mp3prog c:\tes\y\a.mp3

C:\>

or

C:\>for /f %f in ('dir c:\tes /s/b') do @echo mp3prog %f
mp3prog c:\tes\103.gif
mp3prog c:\tes\a.mp3
mp3prog c:\tes\ff
mp3prog c:\tes\gg
mp3prog c:\tes\mof.mp3
mp3prog c:\tes\oo.mpg
mp3prog c:\tes\qw.mp3
mp3prog c:\tes\t.mpg
mp3prog c:\tes\ta.mpg
mp3prog c:\tes\t_.mpg
mp3prog c:\tes\u.mpg
mp3prog c:\tes\uu.mpg
mp3prog c:\tes\y
mp3prog c:\tes\y\a.mp3

C:\>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.