Last active
March 8, 2025 03:48
-
-
Save ageldama/bd5ce35182908ae39f63e741c87fa228 to your computer and use it in GitHub Desktop.
s3에서 동영상 용량 모아보기
This file contains hidden or 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
aws s3 ls files-dev --recursive >> s3-dev-ls.txt | |
aws s3 ls files-storage --recursive >> s3-prod-ls.txt |
This file contains hidden or 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
cat s3-dev-ls.txt | awk '{print $4}' | awk -F. '{print $NF}'|sort|uniq >> dev-exts.txt | |
cat s3-prod-ls.txt | awk '{print $4}' | awk -F. '{print $NF}'|sort|uniq >> prod-exts.txt | |
# ...이렇게 뽑은 dev-exts.txt prod-exts.txt을 편집하여 동영상 파일인 것으로 보이는 것들만 추려냄. |
This file contains hidden or 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
cat s3-dev-ls.txt|perl ./sum.pl | |
# ==> 19.696GiB | |
cat s3-prod-ls.txt|perl ./sum.pl | |
# ==> 715.127GiB |
This file contains hidden or 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
#!/usr/bin/env perl | |
use warnings; | |
use bigint; | |
BEGIN { | |
our $sum = 0; | |
} | |
END { | |
print qx/numfmt --to=iec-i --suffix=B --format="%.3f" $sum/, "\n"; | |
} | |
while (<>) { | |
my @a = split /\s+/, $_; | |
my $size = $a[2] + 0; | |
my $name = $a[3]; | |
if ($name =~ /asf|avi|DCM|m4a|mkv|mov|mp4|mpg|webp|wmv/i) { | |
$sum += $size; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment