Dec-18-2019, 09:48 PM
(This post was last modified: Dec-18-2019, 11:13 PM by Gribouillis.)
What I am trying to do is get a list of files in a directory and run a command on each of those files.
The command needs the file name in there as to call the file and I would like to use the file name in the output file name.
The command needs the file name in there as to call the file and I would like to use the file name in the output file name.
1 2 3 4 5 6 7 8 9 10 |
import os dirlist = os.listdir( 'C:\\Users\\user\\Desktop\\test\\logs' ) #this pulls the file names and puts it into #a list # take each item in the list and execute the following command where dirlist is a #file name in my list for dirlist in os.listdir(): myCmd = "C:\\Users\\cmueller\\Desktop\\test\\logs\\this.exe -E [b]['dirlist'][/b] -c [b]['dirlist'][/b]_end_dump" # -E is the file to run command against and -c is the output #filename os.system(myCmd) |