added
This commit is contained in:
16
play_with_os/scan_test.py
Normal file
16
play_with_os/scan_test.py
Normal 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)
|
||||
Reference in New Issue
Block a user