title: Making a backup file + appending date time + moving file if the file exists. PYTHON
body: <p>I have a few of the pieces of this working but I'm struggling with putting them together. </p>
  
  <p>I would like to take a file, move it to a backup folder, get the date time from that file, and append it to the file's name / change the file's name to file name + date time. </p>
  
  <p>This part gets the date time in the format I want it. (print line is the date time formatted properly, but I don't need to print this line)</p>
  
  <pre><code>    Filepath = "C:\\SyncWork\\ACE\\Files\\ESAL_P\\ESAL_P.txt"
      modifiedTime = os.path.getmtime(Filepath) 
      firstFile = os.path.getmtime(Filepath)
  
      print (datetime.fromtimestamp(modifiedTime).strftime("%b-%d-%y-%H:%M:%S"))
  </code></pre>
  
  <p>This part will rename / move the file (But it's missing the datetime) </p>
  
  <pre><code>    prevName = 'c:\\syncwork\\ace\\files\\ESAL_P\\ESAL_P.txt'
      newName = 'c:\\syncwork\\ace\\files\\ESAL_P\\Backup\\ESAL_P.txt'
  
      os.rename(prevName, newName)
  </code></pre>
  
  <p>How do I turn the print line with the formatting that I like into a string and append it to the end of the newName line? </p>
  
  <p><strong>AFTER my question was answered</strong> 
  My final code looked like this:</p>
  
  <pre><code>Filepath = "C:\\SyncWork\\ACE\\Files\\ESAL_P\\ESAL_P.txt"
  modifiedTime = os.path.getmtime(Filepath) 
  
  
  
  timestamp = datetime.fromtimestamp(modifiedTime).strftime("%b-%d-%Y_%H.%M.%S")
  
  prevName = 'c:\\SyncWork\\ACE\\Files\\ESAL_P\\ESAL_P.txt'
  newName = 'c:\\SyncWork\\ACE\\Files\\ESAL_P\\Backup\\ESAL_P' 
  
  os.rename(prevName, newName+"_"+timestamp + ".txt")
  print(newName)  
  </code></pre>