The current issue im facing is comes from the following scenario. I have a script that runs a commandline program to find all files of a certain extension within an specific folder, lets call these files File A. Another section of the script runs a grep command through each file for filenames within File A. What would be the best method to store what filenames are in File A and only File A, and how could I achieve it? Thanks
Share
EDIT: I see you were the one who asked the previous question! Why open a new one?
There was a recent question on this exact problem — the structure you are modelling is a directed graph. See my answer to that question, using Python’s
networkxpackage. Using this package is a good idea if you are going to do some post-processing of the data. However, for simple situations, you could make your own data structure. Here is a sample using an adjacency list representation of a graph; it is not difficult to use an adjacency matrix instead.This will give you a dictionary of filename -> files linked by that file.