Bias in PDIR

Jun 24, 2008
223
0
Siegen, Germany
Hi,

I recently noticed a bias between the output of
1) PDIR /(zKc sp) and
2) The file sizes reported by Windows.

E.g. PDIR /(zKc sp) readme.txt returns "0 E:\temp\down\readme.txt", while Windows - correctly reports - "1 kb" (Explorer).
Annotation: DIR readme.txt - also correctly - delivers "28.06.2008 19:04 984 readme.txt"

nickles
 
May 20, 2008
3,515
4
Elkridge, MD, USA
nickles wrote:
| Hi,
|
| I recently noticed a bias between the output of
| 1) PDIR /(zKc sp) and
| 2) The file sizes reported by Windows.
|
| E.g. PDIR /(zKc sp) readme.txt returns "0 E:\temp\down\readme.txt",
| while Windows - correctly reports - "1 kb" (Explorer). Annotation:
| DIR readme.txt - also correctly - delivers "28.06.2008 19:04 984
| readme.txt"

Verified in TCC 9.02.151 - PDIR always truncates, instead of rounding the
fractional part of the reporting unit.

pdir/(zc zk zK fn) reports for a given (test) directory:

997 0 0 997.txt
998 0 0 998.txt
999 0 0 999.txt
1,000 1 0 1000.txt
1,001 1 0 1001.txt
1,002 1 0 1002.txt
1,003 1 0 1003.txt
1,004 1 0 1004.txt
1,022 1 0 1022.txt
1,023 1 0 1023.txt
1,024 1 1 1024.txt
1,025 1 1 1025.txt
1,026 1 1 1026.txt
1,027 1 1 1027.txt
1,028 1 1 1028.txt

--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
Steve Fábián wrote:

> nickles wrote:
> | Hi,
> |
> | I recently noticed a bias between the output of
> | 1) PDIR /(zKc sp) and
> | 2) The file sizes reported by Windows.
> |
> | E.g. PDIR /(zKc sp) readme.txt returns "0 E:\temp\down\readme.txt",
> | while Windows - correctly reports - "1 kb" (Explorer). Annotation:
> | DIR readme.txt - also correctly - delivers "28.06.2008 19:04 984
> | readme.txt"
>
> Verified in TCC 9.02.151 - PDIR always truncates, instead of rounding the
> fractional part of the reporting unit.

WAD -- see the documentation for PDIR.

Rex Conn
JP Software
 
Jun 24, 2008
223
0
Siegen, Germany
Ok, read over this...

But, what's the sense behind this design?
Why would one like to have a different result than Windows in that respect?

Please enlighten me :o!

Any other switch available (no script)?

nickles
 
May 20, 2008
3,515
4
Elkridge, MD, USA
rconn wrote:
| Steve Fábián wrote:
|
|
| ---Quote---
|| nickles wrote:
||| Hi,
|||
||| I recently noticed a bias between the output of
||| 1) PDIR /(zKc sp) and
||| 2) The file sizes reported by Windows.
|||
||| E.g. PDIR /(zKc sp) readme.txt returns "0 E:\temp\down\readme.txt",
||| while Windows - correctly reports - "1 kb" (Explorer). Annotation:
||| DIR readme.txt - also correctly - delivers "28.06.2008 19:04 984
||| readme.txt"
||
|| Verified in TCC 9.02.151 - PDIR always truncates, instead of
|| rounding the fractional part of the reporting unit.
| ---End Quote---
| WAD -- see the documentation for PDIR.

As usual, you are correct. However, here is the strange report of the
command
pdir/(zc 4@filesize[*] zk @filesize[*,k] zK @filesize[*,K] fn)/os

0 0 0 0 0 0 0000.txt
1 1 0 1 0 1 0001.txt
2 2 0 1 0 1 0002.txt
997 997 0 1 0 1 0997.txt
998 998 0 1 0 1 0998.txt
999 999 0 1 0 1 0999.txt
1,000 1000 1 1 0 1 1000.txt
1,001 1001 1 2 0 1 1001.txt
1,002 1002 1 2 0 1 1002.txt
1,003 1003 1 2 0 1 1003.txt
1,004 1004 1 2 0 1 1004.txt
1,022 1022 1 2 0 1 1022.txt
1,023 1023 1 2 0 1 1023.txt
1,024 1024 1 2 1 1 1024.txt
1,025 1025 1 2 1 2 1025.txt
1,026 1026 1 2 1 2 1026.txt
1,027 1027 1 2 1 2 1027.txt
1,028 1028 1 2 1 2 1028.txt

Notice the zS (where S is a magnitude prefix) truncates (equivalent to using
the FLOOR function), while %@filesize[*,S] rounds up even 1 byte (as the
CEILING functon does). In many situations one would like to have something
closer to the rounding done by @EVAL.
--
Steve
 
May 20, 2008
3,515
4
Elkridge, MD, USA
nickles wrote:
| Ok, read over this...
|
| But, what's the sense behind this design?
| Why would one like to have a different result than Windows in that
| respect?
|
| Please enlighten me :o!
|
| Any other switch available (no script)?

Dear nickles:

Since you did not quote anything, I am not certain what you are complain
about, but I think you are referring to the differences between Windows
Explorer's file size reporting vs. TCC reporting. TCC will always report the
exact size, no matter how large the file, if you do not specify that you
want only an approximate size (by specifying a reporting size larger than
bytes). If you know the allocation unit of another device, only the exact
size allows you to determine in advance whether or not that device has space
to receive a copy of the file.

TCC is designed for operations that "pure vanilla" Windows (i.e., without
additional programs not included by MS) does not support. That's why it has
so many features, and why in many instances it differs from MS reports.
--
Steve
 
Similar threads
Thread starter Title Forum Replies Date
Phileosophos PDIR to list filenames without extensions? Support 2
vefatica PDIR and streams Support 1
vefatica PDIR with fixed-width unqualified filename? Support 2
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
thedave pdir /s Support 2
Emilio III pdir /f switch Support 1
D pdir ignores pm Support 2
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
M WAD PDir not working correctly... Support 5
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
mfarah More on pdir's options: /(fq) Support 5
mfarah How to? Getting pdir to display relative paths. Support 2
S PDIR and @LABEL questions Support 4
M How to? PDir on multiple wildcard patterns... Support 2
A pdir function usage Support 3
T How to? dir/pdir - 2nd level down only Support 7
JohnQSmith PDIR and descriptions Support 21
G WAD PDIR @IF bug, @WORD bug Support 8
S WAD PDIR: files with percent sign % in name cause not listing other files in directory Support 9
S WAD PDIR ignores exclusion ranges Support 1
M PDir format question... Support 3
M How to? "PDir" not working the way the I _thought _ the documentation said it does… Support 8
S WAD /Sn mishandled in DIR and PDIR, possibly elsewhere Support 15
S Fixed GPF in PDIR Support 3
S PDIR issue Support 1
M PDir causing Take Command/TCC to crash... Support 6
M A "PDir" issue... Support 16
M A simple question related to the "dir" (and "pdir") commands... Support 5
J pdir /b1 issue Support 20
M Missing PDir option... Support 5
J Maybe Not So Hard Pdir Question Support 1
S PDIR fails in 12.10.55 Support 3
J V12 PDIR failure Support 1
S PDIR command causes GPF Support 5
D pdir inconsistency Support 4
S PDIR has trouble processing filenames with embedded percent sign Support 3
P PDIR woes Support 0
gschizas pdir crashes horribly in one specific folder Support 5
S PDIR question Support 2
S pdir /(fq) not working Support 5
R Colored directory listing bug with pdir. Support 1
F pdir problem Support 3
D can PDIR list full filepaths of docs in a nested folder? Support 13

Similar threads