By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,812 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,812 IT Pros & Developers. It's quick & easy.

Directory Size in Windows ActivePerl

Ganon11
Expert 2.5K+
P: 3,652
Hey All,

For fun, I'm trying to write a small script to determine where the majority of my space is being taken up. Unfortunately, on Windows, when I use the -s function on a directory, it returns 0, not the total size of the files/directories contained in the directory.

I looked for some modules to help with this, but I can't seem to find anything that works (on Windows - I'm sure they would work on Linux, but I'm not switching to Linux to use them.

Does anyone know of any easy-to-install Windows modules to find the total size of a directory?

Thanks!
Nov 9 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
You can shell out to windows commands for that but its not clear what type of output you want. Here is an example:

Expand|Select|Wrap|Line Numbers
  1. $dir = qx{dir c:\\windows};
  2. print $dir;
At the DOS prompt type:

dir /?

to get a listing of the dir commands options.

You can also use a module like File::Find but that will drill down through all the sub directories as well and you will need to write a function to add up the file sizes.
Nov 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.