'python3 get all .dart files from given directory
I would like to get all. .dart-files from a specific path.
This is what I've got so far:
import glob
import pathlib
libPathString = str(pathlib.Path.cwd().parent.resolve())
for path in glob.glob(libPathString + "/*.dart", recursive=True):
print(path)
Now this is already giving me all the .dart files in the libPathString - directories. But inside there Ive got a couple of folders that have .dart files and these sub-directories can also have subfolders and so on.
I set recursive = true but that doesn't seem to achieve going through the sub-directories.
What am I missing here?
Solution 1:[1]
I got it working! This is working as expected:
import glob
import pathlib
libPathString = str(pathlib.Path.cwd().parent.resolve())
for path in glob.glob(libPathString + "/**", recursive=True):
if(".dart" in path):
print(path)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris |
