2012 Scripting Games Beginner Event 3: Create a File in a Folder
Summary: Beginner Event 3 of the 2012 Scripting Games requires you to create a file in a folder that may or may not exist.
About this event
Date of Event
4/4/2012 12:01 AM
4/11/2012 12:01 AM
You are a local user, and you want to document the processes that are running on your computer. You decide that you would like to list the name and process ID of each process running on your computer. You want to save this information in a nested folder. Because you use a number of different computers, you are never certain that the folder will exist. The folder is nested off the root directory in the following location:
The following image illustrates the folder/file arrangement.
The image that follows illustrates the contents of the Process3.txt file.
- If you do not have permission off the root, create the nested folder where you have permissions. Keep in mind that the folder MUST be nested, and it must be named 2012sg\event3. The file must be named Process3.txt.
- Your code should check to see if the folder exists. If it does not exist, it should be created, and then the Process3.txt file should be created. If it does exist, the Process3.txt file should be created.
- Your script should not generate errors (that are ignored), even if it does create the Process3.txt.
- Your script does not have to have command-line parameters, but if you want to include them (with a default path that solves this problem), you will gather additional points.
- If you choose to add command-line parameters, you should include comment-based Help that describes the parameters, and a sample example of use.
2012 Scripting Games links
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at firstname.lastname@example.org, 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