This commit is contained in:
2024-10-07 16:53:56 +02:00
parent 603eb6433c
commit df24780183
3 changed files with 75 additions and 5 deletions

16
play_with_os/scan_test.py Normal file
View File

@@ -0,0 +1,16 @@
#! /usr/bin/env Python3
# import OS module
import os
def scandir_recursive(directory):
scan_list = []
for entry in os.scandir(directory):
if entry.is_dir(follow_symlinks=False):
yield from scandir_recursive(entry.path)
else:
yield entry.path
scan_path = "/home/jonnybravo/Downloads"
for i in list(scandir_recursive(scan_path)):
print(i)