Last active
March 29, 2017 22:24
-
-
Save AtmaMani/d6c11add20845bac02e43053ad10b7f2 to your computer and use it in GitHub Desktop.
Walking a directory and collecting all files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
data_root = r'root dir to walk down' | |
for directory, subdir_list, file_list in os.walk(data_root): | |
print(directory) | |
print("\t", end="") | |
print(subdir_list) | |
print("\t\t", end="") | |
print(file_list) | |
=============================================================== | |
``` | |
//qalab_server\pydata\v1051\geosaurus\data_prep\SDs | |
['set1', 'set2'] | |
['ImgSrv_Landast_Mosaic.sd', 'ImgSrv_Iran_WorldView2_Multispectral.sd'] | |
//qalab_server\pydata\v1051\geosaurus\data_prep\SDs\set1 | |
[] | |
['ImgSrv_Landast_Montana2014.sd', 'AGSFS_MMS_KML.sd', 'AGSMS_allextn.sd', 'WFL_usa.sd', 'WTL_usa.sd'] | |
//qalab_server\pydata\v1051\geosaurus\data_prep\SDs\set2 | |
[] | |
['ImgSrv_Landast_Montana2015.sd', 'AGSFS_USA.sd', 'AGSMS_SD.sd', 'WFL_allcapabilities.sd'] | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment