title: Program to check all last modified files in a folder using python?
body: <pre><code>import glob
  import os
  import time
  Path = 'Aabmatica/*'#Folder path
  list_of_files = glob.glob(Path) # * Name of the folder in which all files exist
  latest_file = max(list_of_files, key=os.path.getmtime)
  print()
  print(&quot;last modified/added file is:&quot;,end=&quot; &quot;)
  print(latest_file)
  print()
  modification_time = os.path.getmtime(latest_file)
  local_time = time.ctime(modification_time)
  print(&quot;modified time: &quot;,local_time)
  </code></pre>
  <ol start="2">
  <li><p>I made a python program which gives me name of last modified file in a folder:-</p>
  </li>
  <li><p>This program is running well but the problem is that if I place new file or if I am editing any file in a folder than it is giving me correct output but if I am copying any file into the folder than I am not getting any output.</p>
  </li>
  <li><p>And how can I show all the last modified files from folder using this program.</p>
  </li>
  </ol>
  <p>5.So there is basically two problem with this program if I am copying any file into folder than I am not getting the file name and I am unable to show all the last modified files from folder.</p>