title: how to scan folders in directory and get the folder with the highest number at the end -python
body: <p>i am really new to python and i am trying to automate procedure.
  i have some folders and i want to enter the folder with the highest number at the end.<a href="https://i.stack.imgur.com/fkD8q.png" rel="nofollow noreferrer">in the picture i have some folders. and i want to take the folder with the highest number at the end. for example in this picture, folder_4</a>
  this is what i tried so far. i do not know how to continue or if my code is any effective.</p>
  <pre class="lang-py prettyprint-override"><code>import os
  import shutil
  import glob
  
  path=&quot;N:\QA\Automation\Projects\AT_Projects&quot;
  projectlist = os.listdir(path)
  for project in projectlist:
      projectdir = path + &quot;\\&quot; + project
      file_path=[]
      print(projectlist)
   
      if os.path.isdir(projectdir):
          folders=os.listdir(projectdir)
          for folder in folders:
              file_path=folder
          
        
              if os.folderdir.isdir(folder):
              
                 print('true')
  
     
      else:
          print(&quot;done&quot;)
  </code></pre>
  <p>I want to scan the folder and at the end enter folder_4 to get something from it.</p>
  <p>how do I do this scan?</p>