This script removes unused Endur/Findur binaries that are not used by environments anymore.
The process flow is:
- Loop through all [active] environments
- Determine what servers are connected to the environment:
- Shared Citrix / Deployment Servers
- Dedicated Citrix / Deployment Servers
- Application Servers
- Loop through all connected servers
- Work out the ‘root’ folder for the ‘Endur’ application on that server
- i.e. work out %ENDUR_DRIVE_LETTER%, whether the env name is in the path etc etc.
- Look at the folders under the ‘root’ to see if there is more than just a folder for the currently active Endur version
- For each folder that is not the current version, check to see if it corresponds to an Endur Code Version in the emdash database
- If it does, do a recursive delete. Handle errors where files cannot be deleted through locks etc.
- If it doesn’t, leave well alone.
- This means that we will only remove folders we have put there, and not anything else that may have been delivered by the customer outside of the normal emdash process
- When deleting the files/folders, we can write out details of any files that cannot / have not been deleted.
- As the goal of this workflow is to regain space, I don’t think we should bomb out if some files cannot be deleted
The script is attached below. Feel free to add comments!
0 Comments