I have a file named server1.txt and one more file named server1_copy.txt. In server1.txt, all logs will be added from the application. So whenever a new line is added in the server1.txt, we need to copy that and paste it in the server1_copy.txt. We can keep the code in powershell script and schedule it to run every 30 minutes to perform this action.
I dont have much experiance in Powershell script. But I gone through so many documents in online, could not find a right solution to this.
Does anyone have any idea how we can achieve this using Powershell scripts.
This will copy new lines added to server1.txt to server1_copy.txt in real time.
If you need to bring the files in sync before running the above or that real time is simply unnecessary, a file copy can be done with the
Copy-Item
cmdlet