-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Improve sanitizeDStorageUrl function documentation
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Usage: script/truncate | ||
# Truncate all folders in the bucket | ||
|
||
# Install s3cmd | ||
# brew install s3cmd | ||
# Config | ||
# nano ~/.s3cfg | ||
# | ||
# [default] | ||
# access_key = value | ||
# secret_key = value | ||
# host_base = endpoint.4everland.co | ||
# host_bucket = %(bucket)s.endpoint.4everland.co | ||
# use_https = True | ||
# signature_v2 = False | ||
|
||
BUCKET_NAME="hey-media" | ||
folders=$(s3cmd ls s3://$BUCKET_NAME | awk '/DIR/ {print $NF}') | ||
|
||
total_files_deleted=0 | ||
|
||
for folder in $folders; do | ||
echo "Deleting folder: $folder" | ||
|
||
# Count files in the folder | ||
file_count=$(s3cmd ls --recursive "$folder" | wc -l) | ||
echo "Files in folder: $file_count" | ||
|
||
# Delete files recursively | ||
s3cmd del --recursive "$folder" | ||
|
||
echo "Deleted $file_count files from $folder" | ||
|
||
# Update total files deleted | ||
total_files_deleted=$((total_files_deleted + file_count)) | ||
done | ||
|
||
echo "Total files deleted across all folders: $total_files_deleted" | ||
echo "All folders deleted in bucket: $BUCKET_NAME" |