How to avoid certain directories when using os.walk?

P

Peng Yu

I don't see a way to avoid walking over directories of certain names
with os.walk. For example, I don't want os.walk return files whose
path include '/backup/'. Is there a way to do so? Otherwise, maybe I
will have to make my own program. Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

using os.walk to generate objects 0
os.walk/list 3
os.walk() 5
synching with os.walk() 8
how to avoid spaghetti in Python? 2
os.walk trouble 6
How does os.walk work? 2
os.walk() usage 3

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top