I have a program that I need to run in a list of folders. I have the file path to where the program is and the list to all of the folders where I would like to run the program on my computer (there's about 200 of them). I can also change the current working directory to get to the folder I want to be in.
How do you get python to execute a program through the actual IDE once you are in the folder you want to run the program in? I don't want to have to manually open a terminal on my computer, type "[Program name] [Path to file where I want to run the program]" 200+ times. The code I have is below
cat = '/home/myname/catalogue.csv'
cat = Table.read(cat, format="ascii")
ID = np.array(cat['ID'])
ID = ID.astype(str)
folder_path = np.array([])
for i in ID:
folder_path = np.append(folder_path, '/home/myname/python_stuff/{}/'.format(i))
folder_path = folder_path[folder_path.argsort()]
for i in zip(folder_path, ID):
os.chdir(i[0])
name = i[1] +(".setup")
Essentially after the last line in my code I want another line that is the python equivalent of "run [program name] on name (which is the name of the file in each folder I want it to use)