title: Python How to use extended path length
body: <p>I am running my python code on Windows and trying to traverse and store all the file name with their paths in a file. But the Windows has a restriction of 260 characters.</p>
  
  <pre><code>os.chdir(self.config.Root_Directory_Path())        
      for root, dirs, files in os.walk("."):
          file_list.extend( join(root,f) for f in files )
      file_name_sorted = sorted(file_list)
      #file_sorted = sorted(file_list, key=getsize)
      #time.strftime("%m/%d/%Y %I:%M:%S %p" ,time.localtime(os.path.getmtime(file)))
      f = open(self.config.Client_Local_Status(),'wb')        
      for file_name in file_name_sorted:
          if (os.path.exists(file_name)):
              #f.write((str(os.path.getmtime(file_name)) + "|" + file_name + "\n").encode('utf-8'))
              pass
          else:
              print(file_name + "|" + str(len(file_name) + len(originalPath)) + "\n")
              print(os.path.getmtime(file_name))
              #f.write((str(os.path.getmtime(file_name)) + "|" + file_name + "\n").encode('utf-8'))
      f.close()
  </code></pre>
  
  <p>Because of the error, os.path.getmtime(file_name) throws an exception file not found. How can I overcome this problem? I tried using //?/ character as prefix, as suggested in </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx</a></p>
  
  <p>But was not successful in using //?/ character. </p>
  
  <p>I tried using os.path.getmtime("////?//" + file_name) #Threw an error invalid path</p>
  
  <p>Please suggest a fix</p>