FOlder properties

Started by erezpaz, November 16, 2016, 08:27:26 AM

Previous topic - Next topic

erezpaz

Hi

I am looking for a way to enumerate folder details:
1. amount of files
2. amount of directories
3. total Size

I don't want to create a for or while loop just get information from windows API.

Thanks

td

I suppose that someone might argue that it could be done with recursion but recursion is just another way of performing iteration so I don't think it is possible to do what you are asking using Win32 APIs without at least a little iteration.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

erezpaz

Hi

I didn't really understand. This data is available in Windows. If i press properties on a directory, Windows calculate and bring me this data. I do not want to do recursive with Winbatch and prefer Windows can do this for me. Do you know of a way to get this data of Windows?

Thanks

JTaylor

I don't have an answer but thought I would ask a question as this sounds like a conversation where two people might be talking about different things...might be wrong though...

Are you asking if there is a way to pull the information you without actually having to count and sum the info you need file-by-file and directory-by-directory?     Your ending criteria of not wanting to use FOR or WHILE to accomplish the task could be taken different ways.   There may be an easy way to get the info you want but if it involves a Collection object then you may need to use a loop but if you refuse to use a loop of any form then your options diminish if not evaporate completely.

Jim

td

Quote from: erezpaz on November 17, 2016, 04:26:51 AM
Hi

I didn't really understand. This data is available in Windows. If i press properties on a directory, Windows calculate and bring me this data. I do not want to do recursive with Winbatch and prefer Windows can do this for me. Do you know of a way to get this data of Windows?

Thanks

You seem to be assuming that all the data you see in the properties dialog displayed by right-clicking a file or directory in a shell window exists someplace as you see it.  That is simply not the case.  The Windows shell accumulates some of the size info on the fly using an iterative process.   This is easy enough to demonstrate by right-clicking (or using the ribbon 'Properties' menu item) on a folder with a very large number of files and subdirectories on a system with not a lot of CPU horse power and other hardware resources.

The assumption that there is a single, exported API call for every datum displayed by the Windows shell is also false.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

erezpaz

Thanks you for the answers.
I just thought if i can "make" Windows do the count and wait for it results to collect. If it is not the case i can do a loop to collect myself in Winbatch.

Thanks