2010 Scripting Games: Advanced Event 8–Creating Text Files of Specific Sizes
Note: We are no longer accepting entries for this event. See the due dates page for a list of all event due dates.
About This Event
Date of Event
May 5, 2010
May 12, 2010
Your IT networking team has asked for assistance. They are testing network throughput on the Layer 4 switches. In performing their tests, they need the ability to create text files that are specific sizes. They have specifically requested the following sizes: 100 KB, 1 MB, 10 MB, and 100 MB. Because there are several members of the networking team involved in the project, and because they will be working on many different machines during the survey, they have requested a script that will create text files of those specific sizes.
The networking team said if the script would create other sizes, it would be nice, but it is not a requirement. In addition, the files should be filled with actual text (in other words, they should not be empty). If the text is configurable, that would be wonderful, but again it is not a specific requirement. The name of the text file that is created should conform to this pattern: TestFile100K.txt. The destination folder should be configurable. The networking team said that the size of the file should be accurate to plus or minus 1 percent, but they would of course love it if the files were the exact size.
The following image illustrates one approach that would be acceptable to the networking team: the repetition of a single phrase in the text file.
The following image displays the properties of the text file, and indicates that although the size of the file on the disk is 100 KB, the actual size of the file is 99.9 KB. This file would be acceptable to the networking team because it falls within the 1 percent guideline.
2010 Scripting Games Links
Ed Wilson and Craig Liebendorfer, Scripting Guys