title: Trying to create $now folder and copy .sql files created folders
body: <p>I have a shell script that I am trying to run every few days that copies .sql database files and moves them into a designated folder appeneded with /$now/. The script executes perfectly, but I am getting a cp: cannot create regular file '/path/to/dir/$now/': No such file or directory.</p>
  
  <p>I know these folders exist because it is showing up when I 'ls -ltr' the directory. </p>
  
  <p>All of my permissions are executable and writable.This has been puzzling me for about a week now and I just cant put a finger on it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#!/bin/bash
  BACKUP_DIR="/backups/mysql/"
  FILE_DIR=/dbase/files/
  now=$(date +"%Y_%m_%d")
  
  # setting the input field seperator to newline
  IFS=$'\n'
  
  # find db backups and loop over
  for file in $(find ${FILE_DIR} -maxdepth 1 -name "*.sql" -type f -exec basename {} \;); do
      # create backup directory:
      mkdir -p "${BACKUP_DIR}${file%.sql}/${now}"
  
      # copy file over        
      cp "${FILE_DIR}${file}" "${BACUP_DIR}${file%.sql}/${now}/"
  done
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>Update:</p>
  
  <p>Error I am getting:</p>
  
  <pre><code>+ mkdir -pv /backups/mysql/health/2014_12_04
  + cp /dbase/files/health.sql health/2014_12_04/
  cp: cannot create regular file 'health/2014_12_04/': No such file or directory
  </code></pre>
  
  <p>This is happening for all 9 directories already created</p>