mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:36:29 +00:00
gdrive update
This commit is contained in:
@@ -79,11 +79,20 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
echo "Cleaning up older files on Google Drive..."
|
echo "Cleaning up older files on Google Drive..."
|
||||||
powershell """
|
powershell """
|
||||||
# Get the list of files in the Google Drive folder
|
# List all files in the Google Drive folder
|
||||||
\$files = rclone lsf --files-only --dirs-only --max-depth 1 AzaionGoogleDrive:${params.GOOGLE_DRIVE_FOLDER} --format "tp" | Sort-Object -Descending
|
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"
|
||||||
|
Write-Output "Files found on Google Drive:"
|
||||||
|
Write-Output \$files
|
||||||
|
|
||||||
|
# Sort the files by date in descending order
|
||||||
|
\$filesSorted = \$files | Sort-Object -Descending
|
||||||
|
|
||||||
# Keep only the 3 latest files
|
# Keep only the 3 latest files
|
||||||
\$filesToDelete = \$files | Select-Object -Skip 3
|
\$filesToDelete = \$filesSorted | Select-Object -Skip 3
|
||||||
|
|
||||||
|
# Display the files to delete
|
||||||
|
Write-Output "Files to delete: \$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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user