title: can Linux Bash search for file every 60 seconds and execute file commands? how would I do this?
body: <p>Basically I want to do something like this from bash.
   if a file exists in a directory rename,move,whatever 
   if it doesn't exist loop every 60 seconds:</p>
  
  <pre><code># Create ~/bin
  cd ~/
  if dir ~/bin does not exist
  then mkdir ~/bin
  
  #!/bin/bash
  
  # Create ~/blahhed &amp;&amp; ~/blahs
  if dir ~/blahhed does not exist
  then mkdir ~/blahhed
  
  if dir ~/blahs does not exist
  then mkdir ~/blahs
  
  # This will copy a file from ~/blahhed to  ~/blahs
  if ~/blahhed/file exists
  then mv ~/blahhed/file ~/blahs/file
  rm ~/blahhed/file
  else loop for 60s  
  
  # This appends the date and time
  # to the end of the file name
  date_formatted=$(date +%m_%d_%y-%H,%M,%S)
  if ~/blahs/file does exist
  then mv ~/blahs/file ~/blahs/file.$date_formatted
  rm ~/blahs/file
  else loop for 60s
  </code></pre>
  
  <p>Ok Ive rewritten it like this am I on the right track here?</p>
  
  <pre><code># Create ~/bin
  cd ~/
  if [! -d ~/bin]; then
  mkdir ~/bin
  if [ -d ~/bin]; then
  
  #!/bin/bash
  
  # Create ~/blahhed &amp;&amp; ~/blahs 
  if [! -d ~/blahhed]; then
  mkdir ~/blahhed
  
  if [! -d ~/blahs]; then
  mkdir ~/blahs
  
  # This will copy a file from ~/blahhed to  ~/blahs
  while if [ -d  ~/blahhed/file]; then
  do
  mv ~/blahhed/file ~/blahs/file
  rm ~/blahhed/file
  continue
  
  # This appends the date and time
  # to the end of the file name
  date_formatted=$(date +%m_%d_%y-%H,%M,%S)
  if [! -d ~/blahs/file]; then
  mv ~/blahs/file ~/blahs/file.$date_formatted
  rm ~/blahs/file
  sleep 60 seconds
  </code></pre>