You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
input="tables2.txt"
while IFS= read -r line
do
echo $line
(du -bch *$line* 2>/dev/null | tail -1| awk '{print $1}') | sed s/"M"// >> result.txt
done < "$input"
Folder size calculation
######
#
# WLP-IR disk calculation
#
######
echo -e "${yellow}*** select operation ***${nc}"
echo " 1)Calculate with file exclusion"
echo " 2)Calculate directories size by pattern"
echo " 3)Calculate directories size by pattern and exclusion"
echo " 4)Calculate directories size by excat folder name exclusion"
read n
if [ $n -eq 1 ]; then
oldPath=$(pwd)
echo "Please enter path for calculation(ex: /app/wlp/nrt)"
read fileExPath
echo "Please enter file pattern exclusion. (ex: *.json)"
read excludeName
cd $fileExPath
du -sh --exclude=$excludeName
cd $oldPath
fi
if [ $n -eq 2 ]; then
oldPath=$(pwd)
echo "Please enter path for calculation(ex: /app/wlp/nrt)"
read fileExPath
echo "Please enter directory pattern. (ex: jb3)"
read dirPattern
cd .
du -bch *$dirPattern* | tail -1
cd $oldPath
fi
if [ $n -eq 3 ]; then
oldPath=$(pwd)
echo "Please enter path for calculation(ex: /app/wlp/nrt)"
read fileExPath
echo "Please enter file pattern to exclude. (ex:*.json)"
read excludeName
echo "Please enter directory pattern. (ex: jb3)"
read dirPattern
cd $fileExPath
du -bch *$dirPattern* --exclude=$excludeName | tail -1
cd $oldPath
fi
if [ $n -eq 4 ]; then
oldPath=$(pwd)
echo "Please enter path for calculation(ex: /app/wlp/nrt)"
read fileExPath
echo "Please enter exact directory name to exclude. (ex: jb3)"
read dirPattern
cd $fileExPath
du -bch --exclude=$dirPattern | tail -1
cd $oldPath
fi