Using python 2.7, I need to turn the following Unix find command into a python one.
find . -type d -name "tmp_*" -prune
I will not know the structure of the tree until I receive it. I am trying to search for all tmp_* folders in a tree that can look like this. The "junk" is hundreds more files and sub-directories that I don't want to traverse thru.
/root/A/Match/Junk...
/root/A/B/Match/Junk...
/root/A/B/Match/Junk...
/root/A/B/Match/Junk...
/root/A/B/C/Match/Junk...
I have tried various methods of glob.glob and manipulating the os.walk variables with no success. Excluding directories in os.walk.
Any ideas?
EDIT:
I've tried the 2 methods Rob has suggested without success. All folder branches will end in a "tmp_*" however I don't know when, so I can't prematurely manipulate the os.walk variables
root/Container1/A/tmp_1/junk/junk/junk
----------------A/tmp_2...
----------------A/tmp_3...
----------------A/tmp_4...
----------------B/tmp_1...
root/Container2/C/tmp_1...
root/Container3/Container4/D/tmp_1...