title: How to check if a file is older than 30 minutes in unix
body: <p>I've written a script to iterate though a directory in Solaris. The script looks for files which are older than 30 minutes and echo. However, my if condition is always returning true regardless how old the file is. Someone please help to fix this issue.</p>
  
  <pre><code>for f in `ls -1`;
  # Take action on each file. $f store current file name
  do
    if [ -f "$f" ]; then
    #Checks if the file is a file not a directory
    if test 'find "$f" -mmin +30'
    # Check if the file is older than 30 minutes after modifications
    then
       echo $f is older than 30 mins
    fi
   fi
   done
  </code></pre>