Learn about Windows PowerShell
Summary: Beginner Event 8 of 2011 Scripting Games uses Windows PowerShell to report disk space that is consumed by files in a folder.
About this event
Date of Event
4/13/2011 12:01 AM
4/20/2011 12:01 AM
You are concerned with the shrinking amount of free disk space on your computer. After some preliminary work, you have narrowed down the problem to one particular folder. You decide to obtain a listing of all the files in the folder, and write the information from the directory listing to a comma-separated value (CSV) file so that you can open the CSV file in a Microsoft Excel spreadsheet for further analysis. A sample output is shown in the following image.
2011 Scripting Games: All Links on One Page
Submit your scripts on PoshCode
Support our Sponsors!
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy
Thankyou for this challenge, I have submitted mine about an hour ago. I decided to go against the formatting Name Length WriteTime I hope this does not deduct points?
not a problem. in fact i loved your script.
Is having the data automatically separated into their own columns in Excel a requirement for this challenge?
@Chee Vang as opposed to having all of the data showing up in a single column, yes. If you have a better way of displaying the data that will make a better script, I would like to see it. Remember, the output is simply a sample output that might meet the requirement. If you want to do something better, I am looking forward to it.
Must the script only process the "current" folder or also recursively process the content of existing files in subfolders?
You only need to process the current folder. You may wish to allow it to recurse, but that would be for extra points (as would be allowing it to specify alternate folders)
Hi Ed, I hope all is well and Love the games I am learning a sleuth of knowledge.
2 of my scripts one for event 8 beginner and for advanced event # 9 have not been scored. Is this okay?
I know they are on the posh code site since yesterday but with no one looking at them. Let me know and thanks for everything.
Yes it is quite normal for your scripts to have not been graded yet. Many of the judges, including myself, have been in Vegas for the last several days attending the powershell deep dive. I am at airport right now on way home - using my windows 7 mobile phone to answer you. I will begin grading scripts again tomorrow and will continue throughout the weekend until the final leader board on Monday.