Maybe this snippet will help, too:
echo -e "Please enter the Directory you would like to scan: \c"
read dir
find $dir -size +5000k -print > ~/bigfiles 2>&1
echo -e "Press Y if you would like to see a list of the files found: \c"
read ans
while [ -s ~/bigfiles ]
do
if [ $ans = y -o $ans = Y ]; then
echo "The files will be listed with less"
less ~/bigfiles
exit 0
else
echo "Exiting script...."
exit 0
fi
done
echo "Did not find any big files"
exit 0
- wil
Code:
# script to find big files echo -e "Please enter the Directory you would like to scan: \c"
read dir
find $dir -size +5000k -print > ~/bigfiles 2>&1
echo -e "Press Y if you would like to see a list of the files found: \c"
read ans
while [ -s ~/bigfiles ]
do
if [ $ans = y -o $ans = Y ]; then
echo "The files will be listed with less"
less ~/bigfiles
exit 0
else
echo "Exiting script...."
exit 0
fi
done
echo "Did not find any big files"
exit 0
- wil