Skip to content

Instantly share code, notes, and snippets.

@prochor666
Created September 20, 2019 12:02
Show Gist options
  • Save prochor666/c01f0371aa9b7d5964277e01c4db3a49 to your computer and use it in GitHub Desktop.
Save prochor666/c01f0371aa9b7d5964277e01c4db3a49 to your computer and use it in GitHub Desktop.
Web hosts direcotry sizes to CSV
#!/bin/bash
# ---------------------------------------------------------------------
# Web hosts size script
# prochor666@gmail.com
# This script is licensed under GNU GPL version 2.0 or above
# ---------------------------------------------------------------------
clear
# Setup
WEBROOT="/var/www"
CSVFILE="/root/websize.csv"
echo "dir;size" > $CSVFILE
# Webhosts ackup
for DIR in $WEBROOT/*
do
if [ -d $DIR ]; then
cd $DIR
SIZE="$(du -hs | cut -f1)"
echo "$DIR;$SIZE" >> $CSVFILE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment