gctools-outilsgc / gcconnex

A social network based on Elgg
Other
48 stars 44 forks source link

Research - Pruning old collab DB backups automated task #2567

Closed LecCory closed 12 months ago

LecCory commented 1 year ago

Experiment with automating the jobs to run out of ADO

LecCory commented 1 year ago

Script


$90DaysAgo =[datetime](Get-Date).AddDays(-90)

$filelist = az storage file list -s <fileshare> --account-name <storageAccount> --account-key <accountKey>
$fileArray = $filelist | ConvertFrom-Json

foreach( $file in fileArray){
    if([DateTime]$file.lastAccessTime -lt $90DaysAgo){
        Write-Host "Removing $file.name
         az storage file delete -s <fileshare> -p $file.name
    }
} 
LecCory commented 12 months ago

Pipeline script setup to remove any files older than 90 days https://dev.azure.com/dev-gcx/gccollab-IaC-resources/_git/gccollab-automation-tools