I'm trying to resolve this problem:
Have a tree structure like this:
── geny16
│ ├── gen26xgeny16
│ │ ├── sustrato270
│ │ │ ├── sustrato270_data01.dat
│ │ │ ├── sustrato270_data02.dat
│ │ │ └── sustrato270_data03.dat
│ │ ├── sustrato90
│ │ │ ├── sustrato90_data01.dat
│ │ │ ├── sustrato90_data02.dat
│ │ │ └── sustrato90_data03.dat
│ │ ├── tentata0
│ │ │ ├── tentata0_data01.dat
│ │ │ ├── tentata0_data02.dat
│ │ │ └── tentata0_data03.dat
│ │ └── tenteta90
│ │ │ ├── tentata90_data01.dat
│ │ │ ├── tentata90_data02.dat
│ │ │ └── tentata90_data03.dat
│ └── gen40xgeny16
│ ├── sustrato270
│ ├── sustrato90
│ ├── tenteta0
│ └── tenteta90
└── geny9
├── gen16xgeny9
│ ├── sustrato270
├── sustrato90
│ ├── tenteta0
│ └── tenteta90
├── gen26xgeny9
│ ├── sustrato270
│ ├── sustrato90
│ ├── tenteta0
│ └── tenteta90
└── gen40xgen9y
├── sustrato270
├── sustrato90
├── tenteta0
└── tenteta90
in each deeper folder there are some .dat files that I will manipulate and plot with matplotlib. When I use a python script inside the deeper folder, my work is done: read each data file, normalize a column, superspose and plot data; but as it's the same task for each deep folder, I would like to leave the script in the root folder and that goes through the subfolders to manipulate and plot data.
I can list the name of each element in the tree with this code:
rootDir = '.'
for dirName, subdirList, fileList in os.walk(rootDir):
print('Directorio encontrado: %s' % subdirList)
for fname in fileList:
print('\t%s' % fname)
But it's only a list of names, how can I use this list to navigate and execute my script to manipulate and plot data in each deeper folders?
Thanks in advance for your comments and suggestions.
Gustavo.