Welcome!

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

SignUp Now!

dir /s works in mysterious ways :(

Aug
11
1
Hi,

I have a simple directory structure:

I:\tmp> tree
I:\tmp
└──x
├──1
│ ├──a
│ └──b
└──2

If I enter "dir /sb" I get what I expect:

I:\tmp> dir /sb
I:\tmp\x
I:\tmp\x\1
I:\tmp\x\2
I:\tmp\x\1\a
I:\tmp\x\1\b

But when I enter "dir /sb x", it doesn't display the whole depth of the tree:

I:\tmp> dir /sb x
I:\tmp\x\1
I:\tmp\x\2

When I use "dir /sb ." I get even less:

I:\tmp> dir /sb .
I:\tmp\x

What am I not getting?

TCC 21.01.46 x64 Windows 10 [Version 10.0.15063]
TCC Build 46 Windows 10 Build 1506
 
Using TCC 21.01.49 (the current build), each of those commands in TCC returns exactly the same thing as CMD.

The question is what results you actually want to return - if you just enter "x", then TCC (and CMD) will look for files named "x". If you enter "x*", they will look for a file or directory beginning with "x".
 
I would assume it works the same as without the "/s". If I enter "dir x", I get the contents of dir "x", not just all files named "x". I find the "/s" bevavior rather counter-intuitive. Plus, it's not even right: "dir /sb x" doesn't show me all the files named "x", see above.

I just checked with CMD (Microsoft Windows [Version 10.0.15063]) and got this:

I:\tmp> dir /s /b x
I:\tmp\x\1
I:\tmp\x\2
I:\tmp\x\1\a
I:\tmp\x\1\b

It looks like I would like to get it, but TCC output is different.
 
First, update to the current version (21.01.49) so we're comparing the same thing.

This is what I get with TCC 21.01.49:

Code:
[F:\tmp]ver
TCC  21.01.49 x64   Windows 10 [Version 10.0.16278]

[F:\tmp]dir /s/b
F:\tmp\x
F:\tmp\x\1
F:\tmp\x\2
F:\tmp\x\1\a
F:\tmp\x\1\b

[F:\tmp]dir /s/b x
F:\tmp\x\1
F:\tmp\x\2
F:\tmp\x\1\a
F:\tmp\x\1\b

[F:\tmp]cmd
Microsoft Windows [Version 10.0.16278.1000]
(c) 2017 Microsoft Corporation. All rights reserved.

F:\tmp>dir /s /b x
F:\tmp\x\1
F:\tmp\x\2
F:\tmp\x\1\a
F:\tmp\x\1\b
F:\tmp>
 

Similar threads

Back
Top