Important: The deadline for this event has passed. Solutions are available in VBScript, Windows PowerShell, and Perl. |
In Let’s Get Together, competitors must read all the text files in a folder, copy the first line of each file, and then paste all those lines into a new text file.
Not a native speaker of English? These event instructions are also available in the following languages: Chinese (Simplified); Chinese (Traditional); French; German; Japanese; Portuguese Brazilian; Russian; and Spanish. For more information, and to access these localized instructions, see the Scripting Games International page.
| About This Event | |
| Event Scenario |
Division | Beginner |
Deadline | Friday, February 22, 2008 (8:00 AM PST) |
Points Awarded | 10 |
In this event, you need to combine the contents of several text files into one. There are a number of things you need to do in order to succeed at this event:
1. | Find all the text files (files with a .txt file extension) in the folder C:\Scripts. (Make sure you use C:\Scripts; if you use any other folder you won’t receive the points for this event.) |
2. | Create a new file named C:\Temp\Newfile.txt. (Once again, the full path and name for the file your script creates must match this exactly.) |
3. | Copy the first line – and only the first line – from each text file in C:\Scripts into your new file. |
That’s it. When your script completes you should have a new file in your C:\Temp folder named Newfile.txt. Newfile.txt should contain the first line – followed by a carriage-return linefeed – from each text file in C:\Scripts.