I am very new to PowerShell but love what I am seeing. I have found a great script exports the folder names, create dates, file path and file type information to a .csv file. What I really need now is to add a column that show the overall folder size including any sub directories. I don’t need the sub directory names just the total for the parent and sub folders.
Can anyone help me add this to the script below? Many thanks for looking.
hmmm … you have to help me to understand what you mean with “overall folder size” for a file. You want to have a list of files and in one column a folder size? I my opinion that does not fit together.
If you wnat to measure a folder size you can use measure-object. For a give folder it could look like this:
hi there, thank you for the reply. I will explain better.
I have a folder called Web, in there are say three say three folders, each of those contain many sub folders and files of different types. currently my script give me a result like this below in the .csv output which is great I just need one more column for the overall size of folder 1, 2 and 3. So a calculation of all sub folders in these three folders. I added the column below Folder size. Does that help?
The problem with using Measure-Object is that its going to be a pretty slow process if you have a lot of folders. PowerShell doesn’t have a method of directly getting the folder size and you have to count through all of the sub-folders.
If you’re prepared to use an old style VBScript approach you can use the FileSystem COM object like this