467,179 Members | 1,234 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

Directory Size in Windows ActivePerl

Expert 2GB
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?

Nov 9 '08 #1
  • viewed: 2171
1 Reply
Expert 2GB
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.

Similar topics

1 post views Thread by Zman | last post: by
9 posts views Thread by Adam Smith | last post: by
4 posts views Thread by al2048@aol.com | last post: by
2 posts views Thread by Technical Group | last post: by
2 posts views Thread by Martin | last post: by
11 posts views Thread by F. Michael Miller | last post: by
1 post views Thread by RomanRev | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.