Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:48:50+00:00 2026-06-14T09:48:50+00:00

I am trying to traverse a directory. Below is the code: file_list = []

  • 0

I am trying to traverse a directory. Below is the code:

file_list = []
    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_sorted = sorted(file_list)
    f = open(self.config.Client_Local_Status(),'wb')        
    for file in file_sorted:
        print(file + "|" + str(os.path.getmtime(file)) + "\n")            
    f.close()

Firstly, I traverse the tree, then sort it and then print it. But I get the below error while traversing. I am very sure that the file exist, but not able to figure out the reason for error. PLEASE HELP ME FIGURE OUT REASON FOR ERROR AND HENCE FIX IT.

Below is the output.

Output:

.\Drivers\Intel Drivers\Applications\Software\Applications\Wave_Embassy_Trust_Suite\EMBASSY Security Center\program files\Wave Systems Corp\EMBASSY Security Center\plugins\cpm.scp\webinterface\ru\js\HelpMessages.js|1229488128.0

.\Drivers\Intel Drivers\Applications\Software\Applications\Wave_Embassy_Trust_Suite\EMBASSY Security Center\program files\Wave Systems Corp\EMBASSY Security Center\plugins\cpm.scp\webinterface\ru\js\Strings.js|1229488128.0

After printing lot of file names successfully, the code fails for one particular file as shown below:

Error:

Traceback (most recent call last):
  File "C:\SyncClientRK\SyncClientRK.py", line 183, in <module>
    SyncClientRK()
  File "C:\SyncClientRK\SyncClientRK.py", line 17, in __init__
    self.getStatus()
  File "C:\SyncClientRK\SyncClientRK.py", line 38, in getStatus
    self.generateLocalStatus()
  File "C:\SyncClientRK\SyncClientRK.py", line 53, in generateLocalStatus
    print(file + "|" + str(os.path.getmtime(file)) + "\n")
  File "C:\Python33\lib\genericpath.py", line 54, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [WinError 3] The system cannot find the path specified: '.\\Drivers\\Intel Drivers\\Applications\\Software\\Applications\\Wave_Embassy_Trust_Suite\\EMBASSY Security Center\\program files\\Wave Systems Corp\\EMBASSY Security Center\\plugins\\cpm.scp\\webinterface\\zh-CHS\\AccessingToolkit.htm'

Please notice that the file is fetched in the loop and is printed, but os.path.getmtime is throwing an error that will not found. Not able to understand why and how to fix this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:48:51+00:00Added an answer on June 14, 2026 at 9:48 am

    That’s a 220 character long filename, starting in a local directory. Assuming that the local directory has a path that is longer than 40 characters, you are hitting an old Windows limit of paths that are longer than 260 characters.

    Not all ways of handling files in Windows has this limit, but it may be that this is the problem here. If there are filenames in your list that is even longer, then this is clearly not the problem, but that’s what I would look into first.

    See also: http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx#maxpath

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to traverse a given directory and create a list of files
I'm trying to traverse a directory and check for duplicate files. void findDuplicates(){ char
I'm trying to recursively traverse through my Drive to search some files. The code
I'm trying to write some Python code that will traverse each directory in the
I am trying to traverse all directories under the current directory using a shell
So I am trying to traverse a directory and find all the instances of
I'm trying to traverse a tree using ANTLR tree commands and recursion. The code
I'm trying to write a function that will traverse the file directory and give
I'm trying to traverse through an XML file using jquery mobile. My code goes
I am trying to traverse Binary search tree with the follwoing code and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.