DIR /S /HL?

May 20, 2008
11,538
103
Syracuse, NY, USA
Are DIR's /S and /HL options compatible? Whenever I try it with a root directory as target, it doesn't recurse and there's a little corruption in the "Total for" line (C:\C:\Windows?). For example,
Code:
v:\> dir /s /hl c:\

 Volume in drive C is unlabeled      Serial number is b813:1d21
 Directory of  C:\*

2015-06-20  03:45         <DIR>    dell
2015-06-20  03:45         <DIR>    HP_ePrint
2014-06-26  13:19         <DIR>    inetpub
2015-06-20  03:45         <DIR>    NVIDIA
2015-06-20  03:45         <DIR>    PerfLogs
2016-08-27  19:50         <DIR>    Program Files
2014-10-19  15:49         <DIR>    temp
2015-11-07  14:37         <DIR>    Users
2013-01-26  16:58         <DIR>    wd
2016-09-05  21:39         <DIR>    Windows
                   0 bytes in 0 files and 10 dirs

    Total for:  C:\C:\Windows
                   0 bytes in 0 files and 10 dirs    0 bytes allocated
       2,442,526,720 bytes free

If I issue "dir /s /hl c:\windows" it also does not recurse, and the "Total for" line looks like this:
Code:
    Total for:  C:\windows\C:\Windows\winsxs\x86_microsoft-windows-ntvdm-system32_31bf3856ad364e35_6.1.7601.17514_none_0014e305d0cff0a7\_default.pif[/code
 
May 20, 2008
11,538
103
Syracuse, NY, USA
They're not compatible - /HL will turn off /S.
It doesn't seem to completely turn it off. After issuing "dir /s /hl" in v:\, I get a normal looking DIR of v:\ followed by
Code:
 Directory of  V:\empty\*

2016-05-14  22:00         <DIR>    .
2016-05-14  22:00         <DIR>    ..
2015-02-16  00:11         <DIR>    foo
                                    = V:\empty\work\empty\foo
2015-02-16  01:18         <DIR>    x64
                                    = V:\empty\work\empty\x64
2016-05-14  21:59               0  a
                                    = V:\empty\work\empty\a
                   0 bytes in 1 file and 4 dirs

    Total for:  V:\empty\V:\empty\work\empty\a
                   0 bytes in 1 file and 4 dirs    0 bytes allocated

    Total for:  V:\V:\empty\work\empty\a
           4,944,030 bytes in 68 files and 14 dirs    5,156,864 bytes allocated
       8,093,138,944 bytes free
 
May 20, 2008
11,538
103
Syracuse, NY, USA
Let's forget the /S. It's still a bit of a mess. Below, v:\empty doesn't contain anything called "work". The only "work" within miles is h:\work, for which v: is a SUBST.
Code:
v:\empty> tree

V:\empty
├──foo
└──x64

v:\empty> dir /m /k
2016-05-14  22:00         <DIR>    .
2016-05-14  22:00         <DIR>    ..
2015-02-16  00:11         <DIR>    foo
2015-02-16  01:18         <DIR>    x64
2016-05-14  21:59               0  a

v:\empty> dir /m /k /hl
2016-05-14  22:00         <DIR>    .
2016-05-14  22:00         <DIR>    ..
2015-02-16  00:11         <DIR>    foo
                                    = V:\empty\work\empty\foo
2015-02-16  01:18         <DIR>    x64
                                    = V:\empty\work\empty\x64
2016-05-14  21:59               0  a
                                    = V:\empty\work\empty\a

v:\empty and its subdirectories are just ordinary directories. The same sort of thing happens elsewhere, in fact, in all subdirectories of a SUBST.
Code:
v:\ip> dir /hl

 Volume in drive V is DATA           Serial number is c007:d3e4
 Directory of  V:\ip\*

2016-06-08  14:29         <DIR>    .
2016-06-08  14:29         <DIR>    ..
2016-06-09  15:25         <DIR>    test
                                    = V:\ip\work\ip\test
2016-06-08  14:29           2,730  countrytoipreg.txt
                                    = V:\ip\work\ip\countrytoipreg.txt
2016-06-08  01:11      10,266,296  dbip-country.csv
                                    = V:\ip\work\ip\dbip-country.csv
2016-06-07  22:33       5,862,060  hexdb.bin
                                    = V:\ip\work\ip\hexdb.bin
2016-06-07  23:12           7,168  ipcountry.exe
                                    = V:\ip\work\ip\ipcountry.exe
2016-06-08  12:54             515  tohex.btm
                                    = V:\ip\work\ip\tohex.btm
          16,138,769 bytes in 5 files and 3 dirs    16,150,528 bytes allocated
       8,093,065,216 bytes free
 
Similar threads
Thread starter Title Forum Replies Date
E Fixed Bug with DIR /Z displaying descriptions Support 8
J Paths shown in DIR /B Support 2
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
Jesse Heines How to? How to display picture creation date with dir command Support 6
vefatica WAD DIR.BTM? Support 11
DrusTheAxe DIR reports meaningless SYMLINK information Support 14
C show file description? with dir? Support 8
vefatica DIR /F and streams? Support 7
rps Multi-column DIR /v not displaying all files. Support 5
R How to? Dir specific file search patterns with spaces in the pathnames? Support 6
rps Dir /Nfv -> Alt-F2 Support 2
rps @FILESIZE[....,a] allocated size not matching Dir results Support 8
A TCMD - Dir Command puts out blank lines? Support 16
S Problems with dir command in the debugger Support 5
M TCC incorrect dir output since Windows 1803 Support 6
x13 Problem listing repository files using DIR http(s)://... Support 8
cxxl dir /s works in mysterious ways :( Support 4
vefatica Help nit (FFIND and DIR with /S) Support 0
N Fixed Strange dir behavior Support 6
JohnQSmith Weird DIR output (missing lines) Support 1
C 7zip with date range .vs. filelist created with dir and daterange Support 0
D Towards shared (dir-)history lists Support 3
vefatica WAD DIR /HL still gets names wrong Support 16
H Fixed DIR /G returns wrong sizes Support 2
nickles WAD dir.htm Support 2
vefatica DO dir in /s /a:+d /d"g:\" * ( ... ) Support 26
vefatica DIR \\.\...? Support 4
M Fixed DIR /S /B1 ignores "/S" Support 5
C tcmd.ini not loading from program dir? Support 5
D Fixed Dir /Nm:n has changed Support 1
rps How to? dir /s unexpected results Support 10
vefatica Update to current install dir? Support 8
cgunhouse Problem with "dir /=" Support 4
T dir /h error in empty directory Support 22
P WAD TC 15.0.1.58 x64 crasches with a simple dir command Support 18
CWBillow dir /4 strange Support 2
samintz WAD DIR /B1 and /X Support 2
nickles dir behaves inconsistently Support 5
vefatica DIR, streams, and wildcards? Support 1
vefatica DIR /: /u ... streams not counted? Support 7
vefatica Documentation DIR /B /S /: Support 2
samintz How to? DIR listing for exact match Support 1
dcantor WAD dir "ftp:// ..." fails in TCC 15 Support 7
T How to? dir/pdir - 2nd level down only Support 7
MikeBaas How to? DIR: supress extensions? Support 5
old coot dir /s dies on my C: drive Support 2
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
old coot TC DIR command has trouble on my SSD Support 2
M Fixed character set in dir/copy Support 3
C odd behavior of "dir" Support 0

Similar threads