코드:
#!/usr/bin/env bash
# URL 파일 경로
URL_FILE=$1
# URL 파일 존재 확인
if [ ! -f "$URL_FILE" ]; then
echo "Error: URL file '$URL_FILE' not found."
exit 1
fi
# 전체 파일 크기 초기화
total_size=0
# 각 URL에 대해 파일 크기 확인
while IFS= read -r url; do
if [[ -z "$url" || "$url" =~ ^# ]]; then
continue
fi
# 파일 크기 확인 (HEAD 요청)
size=$(wget --spider --server-response "$url" 2>&1 | grep -i "Content-Length" | awk '{print $2}' | tr -d '\r')
if [[ -n "$size" ]]; then
echo "File: $url --> Size: $((size / 1024 / 1024)) MB"
total_size=$((total_size + size))
else
echo "Warning: Could not determine size for $url"
fi
done < "$URL_FILE"
# 총 파일 크기 출력
echo "--------------------------------------"
echo "Total Size: $((total_size / 1024 / 1024)) MB"
echo "--------------------------------------"
돌리는 방법: ./check_file_size.sh k600_dataset_train_fall.txt
결과:
root@60d2390e523f:/workspace/tools/data/kinetics# ./check_file_size.sh k600_dataset_train_fall.txt
File: https://s3.amazonaws.com/kinetics/600/train/falling off chair.tar.gz --> Size: 424 MB
File: https://s3.amazonaws.com/kinetics/600/train/falling off chair.tar.gz --> Size: 424 MB
--------------------------------------
Total Size: 849 MB
--------------------------------------
txt파일:
https://s3.amazonaws.com/kinetics/600/train/falling off chair.tar.gz
https://s3.amazonaws.com/kinetics/600/train/falling off chair.tar.gz
https://s3.amazonaws.com/kinetics/600/train/punching person (boxing).tar.gz
'딥러닝' 카테고리의 다른 글
ai에 대하여 (2) | 2024.12.12 |
---|---|
mmaction의 Dockerfile설정하는 방법(docker-compose도) (1) | 2024.12.11 |
인강) 코렙 시작하기 (4) | 2024.12.11 |
kinetics 600 데이터셋 비디오 특정클래스만 다운받기 (0) | 2024.12.11 |
딥러닝의 평균 전처리 시간, 평균 추론 속도, 평균 후처리 시간이란? (0) | 2024.12.11 |