2013 Scripting Games: Beginner Event 1
Summary: Dr. Scripto needs to gather all log files older than 90 days and move them to an archive location.
Microsoft Scripting Guy, Ed Wilson, is here. This is a day for the history books. Today is the first day of the 2013 Scripting Games as run by the Windows PowerShell community at www.powershell.org. Of course I am in full support mode for the Scripting Games, and I will also participate as a judge. The Scripting Wife is all set and ready to start on the Beginner Events. Without further ado, here is Beginner Event 1…
An Archival Atrocity
Dr. Scripto is in a tizzy! It seems that someone has allowed a series of application log files to pile up for around two years, and they’re starting to put the pinch on free disk space on a server. Your job is to help get the old files off to a new location.
The log files are located in C:ApplicationLog. There are three applications that write logs here, and each uses its own subfolder. For example, C:ApplicationLogApp1, C:ApplicationLogOtherApp, and C:ApplicationLogThisAppAlso. Within those subfolders, the filenames are random GUIDs with a .log filename extension. After they are created on disk, the files are never touched again by the applications.
Your goal is to grab all of the files older than 90 days and move them to \NASServerArchives. You need to maintain the subfolder structure, so that files from C:ApplicationLogApp1 get moved to \NASServerArchivesApp1, and so forth.
Remember that the Scripting Games are being hosted at www.powershell.org, so head on over there to submit your entry.
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. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy