Using Powershell to copy and rename files
Posted on 2012-08-12
I have about ten servers, ServerA, ServerB > etc
Within each server, there is a folder name C:\Program Files\AppName\Files
At the end of every day, a file is generated by the App into that directory. Sometimes, two files can be generated, as the application creates a second one if the initial file is larger than 10MB. After the file is generated, it is zipped up.
Each file is named File-XXXX.log where XXXX is a random set of numbers.
I also have a central reporting server, named Report.
From Report, I need to:
i. Pull the last 7 days of files generated by the app
ii. Unzip them
iii. Rename them from File-XXXX into File1.log, File2.log, File3.log etc
Does anyone know if this is possible using Powershell?