I have a few machines, let's name them A, B, C, D. Every month the machines are backed up and there are three folders that are backed up. To save space within the machines, after backing up the three folders of each machine, I need a script to connect to the source machines and inside each machine's "backup" folder, retain only the latest 7 copies of the ".tgz" files as well as their corresponding ".txt" files. The rest of the tgz and txt files can be deleted.
I am not well versed with powershell script and require some help.
I am not well versed with powershell and have yet to succeed with any script draft
Here is a commented script that should help you understand every steps