mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 23:16:30 +00:00
gdrive update
This commit is contained in:
@@ -81,18 +81,20 @@ pipeline {
|
|||||||
powershell """
|
powershell """
|
||||||
# List all files in the Google Drive folder
|
# List all files in the Google Drive folder
|
||||||
Write-Output "Listing all files in the folder ${params.GOOGLE_DRIVE_FOLDER} on Google Drive..."
|
Write-Output "Listing all files in the folder ${params.GOOGLE_DRIVE_FOLDER} on Google Drive..."
|
||||||
\$files = rclone lsf --files-only --dirs-only --max-depth 1 AzaionGoogleDrive:${params.GOOGLE_DRIVE_FOLDER} --format "tp"
|
\$files = rclone lsf --files-only AzaionGoogleDrive:${params.GOOGLE_DRIVE_FOLDER} --format "tp" --max-depth 1
|
||||||
Write-Output "Files found on Google Drive:"
|
Write-Output "Files found on Google Drive:"
|
||||||
Write-Output \$files
|
Write-Output \$files
|
||||||
|
|
||||||
|
# If files were found
|
||||||
|
if (\$files.Count -gt 0) {
|
||||||
# Sort the files by date in descending order
|
# Sort the files by date in descending order
|
||||||
\$filesSorted = \$files | Sort-Object -Descending
|
\$filesSorted = \$files | Sort-Object -Descending
|
||||||
|
|
||||||
# Keep only the 3 latest files
|
# Keep only the 3 latest files
|
||||||
\$filesToDelete = \$filesSorted | Select-Object -Skip 3
|
\$filesToDelete = \$filesSorted | Select-Object -Skip 3
|
||||||
|
|
||||||
# Display the files to delete
|
Write-Output "Files to delete (older than 3 latest):"
|
||||||
Write-Output "Files to delete: \$filesToDelete"
|
Write-Output \$filesToDelete
|
||||||
|
|
||||||
# If there are files to delete, remove them
|
# If there are files to delete, remove them
|
||||||
if (\$filesToDelete.Count -gt 0) {
|
if (\$filesToDelete.Count -gt 0) {
|
||||||
@@ -110,6 +112,9 @@ pipeline {
|
|||||||
} else {
|
} else {
|
||||||
Write-Output "No files to delete."
|
Write-Output "No files to delete."
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Write-Output "No files found on Google Drive to clean up."
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user