Initial commit
This commit is contained in:
12
source/08-text-files/fileuse/filesearch.py
Normal file
12
source/08-text-files/fileuse/filesearch.py
Normal file
@ -0,0 +1,12 @@
|
||||
import os, glob
|
||||
|
||||
# traverse root directory, and list directories as dirs and files as files
|
||||
for root, dirs, files in os.walk("/home/steve/Code/python/initiation"):
|
||||
for filename in files:
|
||||
path = os.path.join(root, filename)
|
||||
print(path)
|
||||
|
||||
|
||||
# https://docs.python.org/fr/3/library/glob.html
|
||||
files = glob.glob("/home/steve/Code/python/initiation/**/*.py", recursive=True)
|
||||
print(files)
|
Reference in New Issue
Block a user