title: Renaming a single file in python
body: <p>I'm trying to rename an audio file but I keep getting <code>OSError: [Errno 2] No such file or directory</code>.  </p>
  
  <p>In my program, each user has a directory that holds the users files. I obtain the path for each user by doing the following:</p>
  
  <pre><code>current_user_path = os.path.join(current_app.config['UPLOAD_FOLDER'], user.username)
  
  /Users/johnsmith/Documents/pythonprojects/project/files/john
  </code></pre>
  
  <p>Now I want to obtain the path for the existing file I want to rename:</p>
  
  <pre><code>current_file_path = os.path.join(current_user_path,form.currentTitle.data)
  
  /Users/johnsmith/Documents/pythonprojects/project/files/john/File1
  </code></pre>
  
  <p>The path for the rename file will be:</p>
  
  <pre><code>new_file_path = os.path.join(current_user_path, form.newTitle.data)
  
  /Users/johnsmith/Documents/pythonprojects/project/files/john/One
  </code></pre>
  
  <p>Now I'm just running the rename command:</p>
  
  <pre><code>os.rename(current_file_path, new_file_path)
  </code></pre>