i'm trying write few lines of code allows user request list of files in provided directory allows recursive. found answer close want doesn't handle recursion. i'm on python 2.7.x
import glob print glob.glob( '\myfavoritepath\' )
these examples below return filtered file list given path.
# providing same answers os when doing dir getfilelist ( "/myfavoriteppath/" ) getfilelist ( "/myfavoriteppath/*.txt" ) getfilelist ( "/myfavoriteppath/myfile*.txt" )
or
these examples include results root paths contained in given folder.
getfilelist ( "/myfavoriteppath/ -r" ) getfilelist ( "/myfavoriteppath/*.txt -r" ) getfilelist ( "/myfavoriteppath/myfile*.txt -r" )
final requirement needs few lines of code. keeping simple important. should include full list of files , folders match given path.