Get Network Folder Owner and Size
Andrew
![]()
- Joined: Mar 12, 2010
- Posts: 32
Hello,
My goal is to create a job (running every hour or every ten minutes; I know how to trigger this) that:
1. Gets the size and owner of every folder in a certain network directory
2. If the size of the folder is more than 20 GB, and the amount of space left on the network drive is less than 20 GB, send email to the owner of that folder.
I know how to get the owner, folder size, and drive space remaining by using Windows Explorer, but I'm not sure how to transfer that information into WinAutomation. I don't think I can use the macro recorder because there isn't a fixed number of folders in the network directory.
The "Set Variable" action with %FolderVariable.Owner% and %FolderVariable.Size% gave me an error message. I would also prefer to avoid using "Get Files in Folder" and adding up the size of all files in the folder because I'm worried that might take too much time, but maybe that is the only way to compute the size of a folder.
Any suggestions?
Andrew
Samantha
![]()
- Joined: Apr 23, 2010
- Posts: 2326
Andrew
![]()
- Joined: Mar 12, 2010
- Posts: 32
Hello Samantha,
It hadn't occurred to me that I could get the information I needed simply by using the DOS "dir" command. The job you created for me wasn't quite what I was looking for, but I used some of the ideas in it to write the job that I actually needed, which is very close to being complete (and proved to be quite a bit more complicated). Thanks for your help.
I discovered that using /O was the way to get the DOS command to display the owner of the file, but extracting it was a bit harder. Do you know of a more efficient way to split a line of text by an arbitrary number of spaces than splitting by "Space x1" and then removing every empty list item? For example:
" abc def ghijklmn "
becomes a list containing the 3 items "abc", "def", and "ghijklmn", even though the number of spaces between each sequence of letters is different.
Andrew
Samantha
![]()
- Joined: Apr 23, 2010
- Posts: 2326
Andrew
![]()
- Joined: Mar 12, 2010
- Posts: 32
Excellent, that was exactly what I was looking for! The job seems to be working perfectly now. Thank you very much!
Andrew
Samantha
![]()
- Joined: Apr 23, 2010
- Posts: 2326