Minor problem. Incorrect value internal var _dir_files

Apr 13, 2010
236
3
58
The Hague
#1
When using option /Nm:1, DIR returns the correct output but the internal variable _dir_files is zero.

The same variable has the correct value if this option is not used.

I added a screen shot with an example.

Cheers, DJ
 

Attachments

Last edited:
#2
Hmmm! With /Nm:1, I'd expect you'd only see one directory (namely ".") and no files. That's how it works here, and that makes me wonder how it might be used.

If you're talking about _dir_dirs, I see what you mean. _dir_dirs is 0 when /n:m is used.
 
#4
Code:
v:\> *dir /nm:5 i*

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

2014-06-16  21:19  <DIR>  InternetRegistries
2012-06-05  01:46  <DIR>  ip2c
2014-06-03  12:38  <DIR>  ipalloc
2014-05-27  17:01  178  iconshow.btm
2014-06-03  12:34  25,091  ipalloc.txt
  6,475,681,792 bytes free

v:\> echo %_dir_dirs
0

v:\> echo %_dir_files
0
 
#7
Hmmm! Compare these two, one of which worked, one of which didn't. Notice that the tolals line is missing from the second one.
Code:
p:\> *dir /nm:10 v:\i* & echo %_dir_dirs & echo %_dir_files

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

2014-06-16  21:19  <DIR>  InternetRegistries
2012-06-05  01:46  <DIR>  ip2c
2014-06-03  12:38  <DIR>  ipalloc
2014-05-27  17:01  178  iconshow.btm
2014-06-03  12:34  25,091  ipalloc.txt
2013-10-20  01:26  244  ipconfigall.btm
2013-11-02  17:10  617  ipcountry.btm
2013-11-03  14:48  831  ipcountry2.btm
2014-06-03  12:36  17,567  ipreg.txt
  44,528 bytes in 6 files and 3 dirs  65,536 bytes allocated
  6,475,677,696 bytes free
3
6

p:\> *dir /nm:5 v:\i* & echo %_dir_dirs & echo %_dir_files

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

2014-06-16  21:19  <DIR>  InternetRegistries
2012-06-05  01:46  <DIR>  ip2c
2014-06-03  12:38  <DIR>  ipalloc
2014-05-27  17:01  178  iconshow.btm
2014-06-03  12:34  25,091  ipalloc.txt
  6,475,677,696 bytes free
0
0
 
#8
When I ask for fewer than exist, it fails. No SUBST involved here.
Code:
s:\> *dir /nm:129 c:\windows\system32\i* | grep allocated & echo %_dir_dirs & echo %_dir_files
0
0

s:\> *dir /nm:130 c:\windows\system32\i* | grep allocated & echo %_dir_dirs & echo %_dir_files
  57,448,217 bytes in 125 files and 5 dirs  57,655,296 bytes allocated
5
125

s:\> *dir /nm:131 c:\windows\system32\i* | grep allocated & echo %_dir_dirs & echo %_dir_files
  57,448,217 bytes in 125 files and 5 dirs  57,655,296 bytes allocated
5
125