title: Shell Script to copy all files in a directory to a specified folder
body: <p>I'm new in shell script and I am trying to figure out a way to write a script that copies all the files in the current directory to a directory specified from a .txt file and if there are matching names, it adds the current date in the form of FileName_YYYYMMDDmmss to the name of the file being copied to prevent overwritting.</p>
  
  <p>Can someone help me out?</p>
  
  <p>I saw thinking something along the lines of</p>
  
  <pre><code>#!/bin/bash
  
  source=$pwd          #I dont know wheter this actually makes sense I just want to
                       #say that my source directory is the one that I am in right now
  
  destination=$1       #As I said I want to read the destination off of the .txt file
  
  for i in $source     #I just pseudo coded this part because I didn't figure it out.   
  do
     if(file name exists)
     then 
         copy by changing name
     else
         copy
     fi
  done   
  </code></pre>
  
  <p>the problem is I have no idea how to check whether the name exist and copy and rename at the same time.</p>
  
  <p>Thanks</p>