Hello users of stackoverflow,
I had a question on how to target specific folders when looking within a folder for example, look at the directory tree below:
--> MAIN FOLDER --> Subject 1 --> A_Folder --> files
--> Subject 2 --> A_Folder --> files
--> B_Folder --> files
--> Subject 3 --> A_Folder --> files
--> B_Folder --> files
So Subject 1 has only one subfolder, A_Folder, but Subject 2 and Subject 3 both have two sub folders, A_Folder and B_Folder.
My goal is I want to add the contents of Subject 2 and Subject 3's A_Folder and B_Folder, but ignore Subject 1's A_Folder.
Currently this is how I am targeting the folders...
A_files = []
for dirName, subdirList, fileList in os.walk(Path):
for filename in fileList:
if "A" in dirName:
A_files.append(os.path.join(dirName,filename))
B_files = []
for dirName, subdirList, fileList in os.walk(Path):
for filename in fileList:
if "B" in dirName:
B_files.append(os.path.join(dirName,filename))
I appreciate your help!