| View previous topic :: View next topic |
| Author |
Message |
mbell Newbie
Joined: 19 Jun 2002 Posts: 11
|
Posted: Fri Jun 26, 2009 11:08 pm Post subject: Getting Directory Sizes |
|
|
Is there an easy way to use VDS 6 to scan a drive and create a list of all of the directory sizes (excluding sub-directories)? I've looked all over and haven't found a way to get the size of a directory. File sizes, yes. But nothing on getting the size of a directory.
Any assistance will be greatly appreciated.
Thank you,
Milton
(in HOT San Antonio, TX) |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jun 27, 2009 12:49 am Post subject: |
|
|
You'll have to make a list of all the files in the directory and total up all the file sizes. Look at it this way; A directory itself has no size at all, but the files within it have size. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
mbell Newbie
Joined: 19 Jun 2002 Posts: 11
|
Posted: Sat Jun 27, 2009 5:18 pm Post subject: RE: Getting Directory Sizes |
|
|
OK, thanks. I'll give your suggestion a try. I also found a program in XP Service Pack 2 called DIRUSE. It can be used to create a text file which contains directory sizes in bytes, KB, or MB. However, it has problems separating the subject line of the log file that's created and the directory listings.
Thanks again,
Milton |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Jun 27, 2009 11:21 pm Post subject: |
|
|
I really don't think you'll even need that as VDS itself is more than capable of getting a list of files in a directory and getting file sizes for each file in that list.
Check out "LIST FILELIST" and "@file(,Z)
You basically just fill a list with all the files in a directory using the "LIST FILELIST" and then you loop through that list and use "@file(,Z)" to get the size of each file, all the while adding up the file sizes as you loop through the list. At the end of the loop, you'll have to the total size of all the files in that directory.
You could even do this for a directory and all of it's sub directories, but that would take a bit more work than just a single directory, but still, it is possible to do this and with relative ease using VDS. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sun Jun 28, 2009 5:30 am Post subject: |
|
|
| Garrett wrote: | | You could even do this for a directory and all of it's sub directories, but that would take a bit more work than just a single directory, but still, it is possible to do this and with relative ease using VDS. |
If it's so easy why has nobody previously posted some sample code, a DSU, or a user function or command?
Sure, the concept is relatively easy enough using VDS. But putting the concept into practice is a little harder. Just thinking about it in my head (say for example for the Windows directory and it's many subs) I can see myself getting stuck in a loop nested too deep error.
Hmm, I just thought it's about time I had a look at vdsflist.dll or even vdsdll.dll. What do know... I actually bought a license from Tommy in Oct 2007 I'm such an idiot! For the last 2 years I could have been using vdsdll instead of drooling over it's demos!  _________________ cheers
Dave |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sun Jun 28, 2009 5:57 am Post subject: |
|
|
| DaveŽ wrote: | | Garrett wrote: | | You could even do this for a directory and all of it's sub directories, but that would take a bit more work than just a single directory, but still, it is possible to do this and with relative ease using VDS. |
If it's so easy why has nobody previously posted some sample code, a DSU, or a user function or command?
Sure, the concept is relatively easy enough using VDS. But putting the concept into practice is a little harder. Just thinking about it in my head (say for example for the Windows directory and it's many subs) I can see myself getting stuck in a loop nested too deep error.  |
Maybe nobody bothered because it is so easy? In fact, I could picture the code in my mind when mbell first posted. If it was so complex, I would've provided some starting code for him... really! I would've! :p Honestly, I really would have if it was something more complex that it really needed some starter code to get him going along there. In fact, I'm sure someone would have uploaded an example script or made a dsu to handle this if it was that complex.
Keep in mind though, he only wants the directories one level deep from the directory he's in, which is a very easy task to manage with VDS.
Dave, take a few aspirins, relax for a bit  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
mbell Newbie
Joined: 19 Jun 2002 Posts: 11
|
Posted: Mon Jun 29, 2009 12:50 pm Post subject: |
|
|
Thanks for the replies. I'm able to use DIRUSE.EXE to get the folder sizes. My main interest in knowing the folder sizes was to detect when users exceeded their folder size quotas. DIRUSE can be configured to create a log file which contains folders that exceed a designated size. I plan to use VDS to load the log and create a list of users who have gone over their quotas.
Thanks again,
Milton |
|
| Back to top |
|
 |
|