Login | |
|
 |
RE: File Count Help - 7/3/2007 6:57:31 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
There are two ways to do this that come to mind. METHOD 1 This method is best if you want the data for all the files in a folder. Use the FileSystemObject to get a collection of all the files that you care about. Make a dictionary that will hold your data. The key for the dictionary will be a string and the value will be another dictionary. Iterate through the files. Each file will have a create date. Take just the date portion of that (it will have time as well) and see if that date already exists in the keys of your dictionary. If it does not exist, then create a temporary dictionary that has two keys "Count" and "Size". Those keys should be assigned a value of 1 and the size of the file respectively. If that date does already exist in the dictionary, simply increment the "Count" for that entry by 1 and add the size of the file to the "Size". When you get done you will have a dictionary that has data like this: Key Value 6/21/06 Count=1;Size=1234 7/1/06 Count=3;Size=56789 1/1/01 Count=5;Size=987654 . . . METHOD 2 This method is best if you have a specific range of dates that you want the data for. Create a loop (While, Do, For, whatever) that loops through the date range one day at a time. For each date do a WMI query for instances of the CIM_Datafile class where the CreationDate equals the day that you are currentl on in the loop. This will give you a collection of CIM_DataFile class instances. The Count of the files for that day is the .Count property of the collection. To get the size, just iterate through the collection adding up all of the individual sizes.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: File Count Help - 7/3/2007 7:09:23 AM
|
|
 |
|
| |
ebgreen
Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
|
Oh...perhaps I misunderstood. Ehvbs' code will tell you about the files that were created today. If that is all that you need then by all means, he has the best solution. I thought that you wanted to collected the information for all of the files in a folder and categorize the counts and sizes for every day/file present.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: File Count Help - 7/6/2007 11:13:14 AM
|
|
 |
|
| |
Fredledingue
Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
|
Use DateDiff("d", time1, times2) with. oFile.DateCreated.
_____________________________
Fred
|
|
| |
|
|
|
|
|