Measuring directory sizes

I wanted to take out a very simple report on the largest sub folders in terms of size, for a profile area on a client site. We have tools to do this, but scripting it was in this case a very quick and dirty way to get the job done.

This script is reusable on all folders. It will enumerate the size of the content of all sub folders on the folder on which you run it, measured in megabytes.

 

Techtip: One-liner to get free space

Say you’d like to copy an exuberant amount of data from one server to another and you’re unsure if the target disk has sufficient space. Perhaps you’d simply like to know how much space you’ve got.  There are several way to check this, but here’s one more, and in my opinion the fastest:

Run this one-liner from any computer, and as long as you run it a user context where you have user rights on the server, you will get the amount of free space in GB.

You can also use this a basis for a script listing out renaming space on several computers or several disks on a single server, but that might be the subject for another article!