watch_folder_size.sh 242 B

1234567891011121314
  1. #!/bin/bash
  2. WATCH_DIR='.'
  3. SD_SIZE='127865454592'
  4. while true; do
  5. DIR_SIZE="$(du -b "$WATCH_DIR" | tail -1 | awk '{print $1}')"
  6. PERCENTAGE="$(echo "$DIR_SIZE / $SD_SIZE" | bc -l)"
  7. echo -ne " $PERCENTAGE % \r"
  8. sleep 1s
  9. done