Estimate
the folder size without unzipping zip file
Many
times, we may face disk or mount point running out of the storage during
unzipping the tar or zip file. We need to estimate the space required for
unzipping the file.
Below the is the sample shell script
which will estimates the space requirement for the unzipping the zip files or
patches.
Notes:
This is the best practice for
the all kind of patching activities, OH patching, APPS patching. DBAs has to
make sure adequate space is available before the patching activity.
#!/bin/ksh
#===============================================================================================#
# Name : folder_size_estimation.sh #
# Written by : Mallik #
# Purpose : This script will Estimate the folder size without unzipping zip file #
# Pending : NONE #
# Creation Date : 14-MAR-2019 #
# Version : 1 #
# ==============================================================================================#
TODAY_DATE=`date +%d%m%Y_%H%M%S`
find /home/mramadur/patches -name "p*.zip" -print > /home/mramadur/patches/zipfiles.lst
totalsize=0
div=1073741824
for zipfiles in `cat /home/mramadur/patches/zipfiles.lst`
do
size=`unzip -l $zipfiles | tail -1 | awk'{ print $1 }'`
totalsize=`expr "$size" + "$totalsize"`
done
TS=$(echo "scale=2; $totalsize/$div" |bc)
echo $TS GB is needed to unzip the patches
Regards,
Mallik
No comments:
Post a Comment