summaryrefslogtreecommitdiff
path: root/misc/dirWalk.py
diff options
context:
space:
mode:
Diffstat (limited to 'misc/dirWalk.py')
-rw-r--r--misc/dirWalk.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/misc/dirWalk.py b/misc/dirWalk.py
new file mode 100644
index 0000000..5fe8d92
--- /dev/null
+++ b/misc/dirWalk.py
@@ -0,0 +1,17 @@
+#! /user/bin/env python3
+
+# Chapter 9 Walk Directory with os.walk()
+
+import os
+
+for folderName, subfolders, filenames in os.walk(os.getcwd()):
+ print('The current folder is: ' + folderName)
+
+ for subfolder in subfolders:
+ print('SUBFOLDER OF ' + folderName + ': ' + subfolder)
+
+ for filename in filenames:
+ print('FILE INSIDE ' + folderName + ': ' + filename)
+
+ print('')
+