Need some guidance on Analysis for finding and outputting folder sizes

I am attempting to create an analysis that will allow me to pull the exact size of all windows computers: My Documents and Desktop folders from any user profiles on that machine. I need it to output that information into a list of some sort so we can see how much data in total each user has on their local device in those 2 locations (for each user profile on the machine). I would also want to limit the data returned to consist of folders larger than say 10MB just to help filter out all the temp profiles, generic user accounts, public profiles, etc. that might clutter up the list.

I have been trying various stuff I have found on the forums for hours and the closest I have come to is this:

((pathnames of it ,((sum of sizes of descendants of it)/1000) as string & " KB") of folders “Desktop” of folders of folder “c:\Users”) whose (substring before " KB" of (item 1 of it) as Integer > 0)

However the problem is, the data returned is really messy and hard to digest.

What I would love is if I could have the output show as MB or GB etc, What would be helpful is if I could export it as a CSV spreadsheet for instance, which has different columns for computer name, for user profile, for size of my documents folder, and for size of Desktop folder. That way, all of the data would be seperated and able to be sorted it in different ways.

Unfortunately I am not great at writing relevancy at all yet, and I am just piecing things together and I feel like I have hit a wall in my understanding of how to get the results I need. Any thoughts or suggestions you guys have would be appreciated!

Thanks in advance,
Zach

You’ve got a good start and almost all the pieces together, that’s very helpful to begin.

Do be careful with descendant folders or files inspectors - that can consume a lot of resources and slow down the client reporting, or even time-out and give up on the query altogether. You can try the following, but test first in the fixlet debugger, and then in an analysis on a few machines before deploying more widely. Make sure the property evaluates no more than once a day, preferably once a week.

Retrieving the pathname is a good start:

(pathnames of it) of folders "Desktop" of folders of folder "c:\Users"

Next add the sizes (in bytes)

(pathnames of it ,sum of sizes of descendants of it) of folders "Desktop" of folders of folder "c:\Users"

Next, convert the bytes into megabytes by dividing by 1024 twice

(pathnames of it , (sum of sizes of descendants of it) / 1024 / 1024 ) of folders "Desktop" of folders of folder "c:\Users"

Then, if you want to show only the ones larger than 10 MB, include a ‘whose’ filter

(pathnames of it , (sum of sizes of descendants of it) / 1024 / 1024 ) whose (item 1 of it > 10) of folders "Desktop" of folders of folder "c:\Users"

If that logic is working correctly (I’m on a phone now and can’t test), then add the second folder you’re looking for

(pathnames of it , (sum of sizes of descendants of it) / 1024 / 1024 ) whose (item 1 of it > 10) of (folders "Desktop" of it; folders "Documents" of it) of folders of folder "c:\Users"
2 Likes

Jason,

Thanks so much for your detailed explanation, This looks like just what I was needing! Awesome work doing that on a phone man!

Regarding the output, is there a way to write this where the device hostname name can be included with the path and the total size in the output? That way I can export that data into an easily readable and sortable report that has all the main info needed at a glance.

Also I was wondering if there is an easy way to include the text " MB" at the end of the size value? I played around with the substring command but I am obviously still missing something with regard to how that one works :slight_smile:

Thanks again for all the help,
Zach

The last relevance I posted should not have “MB” on it.
You can retrieve the property results along with hostname via a Web Report or REST API. The easiest way would be to view this analysis result in the console where it will show the values along with the computername, “Select All”, right-click and “Copy text with headers”, and paste it into Excel. The paste should format it into columns/rows correctly.

Jason,

Thanks again for the help. So, I tried to do the “copy text with headers” however on machines with more than one user profile that meets the criteria I get a value instead of the actual info. Here is an example:

Computer Name Desktop Size in MB My Documents Size in MB
VW1A03178L c:\Users\bbaker\Desktop, 4023 < multiple results >

I also tried web reports but it’s also got strange issues when it comes to formatting the ones with multiple results:

|Computer Name|Desktop Size in MB|My Documents Size in MB||
|---|---|---|---|
|VW1A03178L|c:\Users\bbaker\Desktop, 4023|c:\Users\Public\Documents, 252; "c:\Users\sathrum\Documents| 86"|

Its basically combining the results all into the same line instead of giving me a new hostname line with the result for the next user account. Ideally I would just like for the hostname to appear multiple times in the output if needed next to any values that met the criteria. This seems like such a simple thing to accomplish and I feel like I am very close to having what I need.

Thanks again for your time,
Zach

Ah, ok. Forgot about the whole “multiple results” thing.

Best bet then is still Web Reports. But when you add the column to the report, click the “+” beside the column name in the “Add columns” dialog - that will “expand” the results so you get a separate row in the report for each line. I think that should match your description.

Jason,

I think thats gonna work. Thanks again for all the help!