thank you i will try it.
i allready wrote something like fileage but it is to slow… it take to much when looping through many folders.
i still did not try it in prod env. it still need some changes. feel free to add and correct.
#!/bin/bash
Alter=1000
GroesseINbytes=20
folders=(
"/root/TESTINFO"
"/root/TESTINFO2"
"/root/FILEINFO"
)
for folder in "${folders[@]}"
do
unset files
files+=$(find $folder -type f )
for file in ${files[@]}
do
filesizeBYTES=$(stat -c %s $file)
fileageINepoch=$(stat -c %Y $file)
filemtime=$(stat -c %Y newfile)
currtime=$(date +%s)
fileageINseconds=$(( (currtime - filemtime)))
if [[ $fileageINseconds -le $Alter ]] || [[ $filesizeinBYTES -le $GroesseINbytes ]]
then
status=2
statustext="$file is $fileageINseconds seconds old and $filesizeBYTES Bytes"
echo "$status File age - $statustext"
fi
done
done
output should be like :