2010 Scripting Games: Advanced Event 6–Automatically Copying Files to a Portable USB Drive
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 3, 2010
May 10, 2010
You have a group of files you would like to copy to several portable USB drives for a college course. You do not want to have to drag and drop every time a new drive is inserted into your USB port. You would like instead to automatically copy the files to the drive when the portable drive is inserted into your USB port.
· Your script should allow you to select a file, a group of files, a folder, or a group of folders to contain the files that will be copied.
· Your script should offer a “quiet mode” and a “prompt mode” based upon a switch supplied to the script when it is launched. Quiet mode should be the default. In quiet mode, the script copies the target files/folders to the newly inserted drive without user interaction.
· Your script should run in continuous loop fashion, until it is stopped. Or it should offer to make a specific number of copies based upon a command-line argument. For example, make 5 copies of the data, and then stop.
· Your script should offer a “force” mode that will overwrite existing files, or a “prompt” mode that will prompt before overwriting existing files. This should also be configurable via the command argument.
· Extra points for informing the user of the number of files to be copied and their total size; and for checking to ensure that the newly inserted drive has enough free disk space.
2010 Scripting Games Links
Ed Wilson and Craig Liebendorfer, Scripting Guys