I have to go through each subfolder and extract matching strings from each of the files (File_1, File_2, File_3, File_4, etc.). Unfortunately, I don't know how to do that under Linux.
I have the following structure:
My original code only goes through all the files in the first subfolder (Subfolder A).
import os, glob import sys path = sys.argv for file in glob.glob(os.path.join(path,'*.*')): print "Current file: ", file f = open(file, 'rU') split line do smth
How do I go through the rest of the subfolders? I tried to use os.walk() but so far I only managed to get it to list all the subfolders and files and I can't get it to open each file. Can anyone help?