title: Finding last modified date of files with special extensions
body: <p>I have written the Python script below to find the last modified date of a file:</p>
  
  <pre><code>for root, dirs, files in os.walk(folder_path):
      for f in files:
          last_modified = datetime.fromtimestamp(os.path.getmtime(f)).day
          #do something
  </code></pre>
  
  <p>This code works fine for normal files like .txt files. However, if it encounters files with extensions like .tar.gz or .run, it throws an error saying "No such file or directory" when finding last_modified. </p>
  
  <p><strong>* EDIT *</strong></p>
  
  <p>I realized that, if I change the code as below, it works fine.</p>
  
  <pre><code> for f in files:
          name = os.path.join(root, f)
          last_modified = datetime.fromtimestamp(os.path.getmtime(name)).day
          #do something
  </code></pre>
  
  <p>But why does this happen?</p>