I have a directory of files and folders that look something like this:
Folder_1
|___simulation.sim
|___scene.scene
|___materials
|___mat1.mat
|___emissivity.ems
|___geometry
|___object1.obj
|___object2.obj
The parent directory, Folder_1, contains a simulation file (simulation.sim) that calls a scene file (scene.scene). In turn, the scene file calls a material file (mat1.mat), and a geometry file (object1.obj).
Right now, my process is:
- Use
os.walk
to traverse Folder_1 and find all the files. - Using a separate script, reach each file identified in the previous step identify subfiles that each file calls (ex. when scene.scene calls mat1.mat).
- Search for each file that is called by a parent file within Folder_1
This process works fine. In some cases, I’m able to identify files that ARE called by a parent file but do NOT exist anywhere in Folder_1. For instance, mat1.mat might also call em2.ems, which does not exist.
Since em2.ems does not exist, mat1.mat does not run. Since mat1.mat does not run, scene.scene does not run. Since scene.scene does not run, simulation.sim does not run.
Is there an easy way to keep track of the file relationship such that if em2.ems does not exist, I can directly point back to simulation.sim and alert the user the simulation will not run?
If it helps, I can include the source code, but I feel like this is more of a file/directory/record-keeping issue.