I have file structure like this
\dir1
\subdir1
-file1.txt
-file2.txt
\subdir3
-file2.txt
\dir2
\subdir1
-file1.txt
\subdir2
-file2.txt
I want to use dir1
as reference directory and open file in dir2
when dir2
subdirs
names match to that one in dir1
. So basically open file1.txt
in both \dir1\subdir1\file1.txt
and \dir2\subdir1\file1.txt
and also match the file names as well.
I can walk through the subdirs
but cannot find the logic to compare them
for path, subdirs, files in os.walk(path_to_json) :
for file in subdirs :
print (file)
How can we do this ?