1
I am unable to figure out the right set of commands in a Windows Command prompt FOR /? or bash ls to do this.
The following batch file I wrote demonstrates what I want, but I would like to know if there's a way to do it without a batch file.
@echo off
for /r %%i in (.) do if %%~nxi==.git echo %%i
Seems like I should be able to issue a DIR command with a combination of /s /b and /ad to do this. I'm willing to filter through grep or FIND if I need to.
I obviously don't need a solution that require a script since I already have that as demonstrated above.
Also, Powershell may be a candidate as long as it's a simple command.
Replace
%%
with%
to use the command line:for /r %i in (.) do if %~nxi==.git echo %i
– DavidPostill – 2017-08-18T14:08:28.333That won't work. If you have 1000s of files and directories, you will see 1000s of lines scroll by, and you'll hardly see the one where it echo's out. You'd have to echo >> to some file and the 'type' that file out. Seems painful. – Daisha Lynn – 2017-08-19T21:55:08.840
{shrug} You can tweak that command to only echo the stuff you want (using
@
) and pipe|
the output tomore
– DavidPostill – 2017-08-19T22:01:06.250David, I did try the "@" trick before I posted this question. It didn't work. I did not try the pipe more trick. I'll try that and let you know. – Daisha Lynn – 2017-08-19T23:02:41.843
It worked. I put the
@
on theif
not on thefor
. So the line looks like this:for /r %i in (.) do @if %~nxi==.git echo %i
. Can you please create an answer with your suggestion so I can accept it? – Daisha Lynn – 2017-08-19T23:05:32.397Done. Answer provided. – DavidPostill – 2017-08-20T07:49:40.207