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

  • SEARCH
  • Home
  • 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 6240975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:40:15+00:00 2026-05-24T11:40:15+00:00

hello im trying to do something like // 1. for x in glob.glob(‘/../../nodes/*/views/assets/js/*.js’): //

  • 0

hello im trying to do something like

// 1. for x in glob.glob('/../../nodes/*/views/assets/js/*.js'):
// 2 .for x in glob.glob('/../../nodes/*/views/assets/js/*/*.js'):
    print x

is there anything can i do to search it recuresively ?

i already looked into Use a Glob() to find files recursively in Python? but the os.walk dont accept wildcards folders like above between nodes and views, and the http://docs.python.org/library/glob.html docs that dosent help much.

thanks

  • 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-05-24T11:40:17+00:00Added an answer on May 24, 2026 at 11:40 am

    Caveat: This will also select any files matching the pattern anywhere beneath the root folder which is nodes/.

    import os, fnmatch
    
    def locate(pattern, root_path):
        for path, dirs, files in os.walk(os.path.abspath(root_path)):
            for filename in fnmatch.filter(files, pattern):
                yield os.path.join(path, filename)
    

    As os.walk does not accept wildcards we walk the tree and filter what we need.

    js_assets = [js for js in locate('*.js', '/../../nodes')]
    

    The locate function yields an iterator of all files which match the pattern.

    Alternative solution: You can try the extended glob which adds recursive searching to glob.

    Now you can write a much simpler expression like:

    fnmatch.filter( glob.glob('/../../nodes/*/views/assets/js/**/*'), '*.js' )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
hello im trying to implant something like static.domain.com where we can put our image
I'm trying to get something like this: --------------------------------- | Hello world | Again |
I'm trying to replace something like: $text = Hello <--name--> !!; echo str_replace(--,?,$text); Expected:
hello im trying to make something like github treeslider im new to javascript.. but
I'm trying to get something like: Hello, 0 ( dont get ) Hello2, 100
Hi I trying do something like that: I've got some string - 'Hello World!'
I'm trying to find out if there's a cleaner way to write something like
I'm trying to do something like this .. NSString *string = [NSString stringWithFormat:@Hello World];
I am trying to remove quotes from something like: Hello so that the string

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.