i am new for the shell scripting can any one help me with my requirments . i want to delete file older than 21 days everything works fine but in that dir i got the files with should not be deleted with particular extension like (.info)here is the script i wrote .can anyone help me how to twick the below script
for files in $DIR
do
echo "Looking for Files in $DIR"
find $DIR/* -mtime +21 -exec rm {} \;
echo "Deleted found files"
done
Right now it will just print 'rm filename' instead of actually running 'rm filename', just to test. Remove the echo once you've tested it and are sure it does what you want.