Created
September 20, 2019 12:02
-
-
Save prochor666/c01f0371aa9b7d5964277e01c4db3a49 to your computer and use it in GitHub Desktop.
Web hosts direcotry sizes to CSV
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
#!/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