WAD DO /s /a:d oddity

samintz

Scott Mintz
May 20, 2008
1,532
20
Solon, OH, USA
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
 
May 20, 2008
11,810
118
Syracuse, NY, USA
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.
 
May 20, 2008
11,810
118
Syracuse, NY, USA
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.
 
Apr 2, 2011
1,541
13
54
North Carolina, USA
alias in=pushd %@full[%1] ^ pushd %@left[2,%@full[%1]] ^ %2& ^ popd ^ popd
in v:\ do f in /a:d /s * (echo %@full[%f])
 
May 20, 2008
11,810
118
Syracuse, NY, USA
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.
 

Similar threads