Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD DO /s /a:d oddity

samintz

Scott Mintz
May
1,582
27
I have a directory structure that looks like this:
Code:
C:\TC27
├──event
│  ├──.cov
│  ├──ipch
│  │  └──event-76870a50
│  ├──Release
│  ├──synctest
│  └──x64
│     └──Release
├──library
├──sdk
│  ├──Win32
│  └──x64
└──styles

when I run with a wildcard all the folders are filename only:
Code:
do /a:d /s * (echo %d)
event
library
sdk
styles
.cov
ipch
Release
synctest
x64
event-76870a50
Release
Win32
x64
However, if I specify a path I get really odd results:
Code:
$ do d in /a:d /s .\* (echo %d)
.\event
.\library
.\sdk
.\styles
.\.cov
.\ipch
.\Release
.\synctest
.\x64
.\event-76870a50
.\Release
.\Win32
.\x64
And if I use a more significant path:
Code:
$ do d in /a:d /s ..\TC27\* (echo %d)
..\TC27\event
..\TC27\library
..\TC27\sdk
..\TC27\styles
And this is just plain wrong:
Code:
$ do d in /a:d /s C:\TC27\* (echo %d)
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
C:\TC27\event
C:\TC27\library
C:\TC27\sdk
C:\TC27\styles
 
Hee-hee! Try one like this.

Code:
do f in /a:d /s v:\* ( echo %@full[%f] )

There are 53 directories in the v: tree. That command produces 1007 lines of output, never mentioning, correctly or otherwise, anything below the top level. It actually lists the top level ones (19 of them) 53 times each.
 
Hee-hee! Try one like this.

Code:
do f in /a:d /s v:\* ( echo %@full[%f] )

There are 53 directories in the v: tree. That command produces 1007 lines of output, never mentioning, correctly or otherwise, anything below the top level. It actually lists the top level ones (19 of them) 53 times each.
My fault there. It's processing the directories I specified ( namely, /a:d v:\* ) once for every directory in the tree.
 
alias in=pushd %@full[%1] ^ pushd %@left[2,%@full[%1]] ^ %2& ^ popd ^ popd
in v:\ do f in /a:d /s * (echo %@full[%f])
 
Rex Conn said: Self-inflicted wound - you're using imaginary syntax.

I tend to do the same thing because I use FFIND /S a lot. With FFIND, you specify the target set and the top of the recursion together.
 
With /s, DO changes directories as it loops, but if you search for C:\TC27\*, it will search for that, regardless of what the current directory is, since you gave the full path.
 
Last edited:

Similar threads

Back
Top