Discussion:
FOR variable shows size of folder...sometimes
(too old to reply)
Tom Del Rosso
2024-08-04 01:08:01 UTC
Permalink
Weirdness...

This happens in a batch and also at the command prompt:

for %a in (C:\CAS) do echo %~Za
0

The above is consistent.
This is not:

for %a in (\\e1\BU1\20240714\C\CAS) do echo %~Za
12288

But it says 0 the first time...sometimes.

So network folders have this size value that FOR sometimes shows.

It's not a problem for me because I don't need the number, but I wonder
what the number means. It is not the size of any file in the folder, and
it doesn't seem conssitent with what the space occupied by the folder
itself should be.
--
Defund the Thought Police
JJ
2024-08-04 10:49:02 UTC
Permalink
Post by Tom Del Rosso
Weirdness...
for %a in (C:\CAS) do echo %~Za
0
The above is consistent.
for %a in (\\e1\BU1\20240714\C\CAS) do echo %~Za
12288
But it says 0 the first time...sometimes.
So network folders have this size value that FOR sometimes shows.
It's not a problem for me because I don't need the number, but I wonder
what the number means. It is not the size of any file in the folder, and
it doesn't seem conssitent with what the space occupied by the folder
itself should be.
Odd... I can't reproduce the problem in my system. Any folders always give
empty size. Remote or not. Mapped or not.

But for unknown reason, your remote folder is also seen as a file.

Technically, the data of a folder is the list of files/subfolders of a
folder. i.e. the file/folder names, timestamps, attributes, security
attributes (if NTFS), starting cluster number, etc. So, that 12,288 bytes
size would likely be the size of the list rounded up by disk cluster size.
Loading...