|Welcome to the Monastery|
calling an exe and its input and target filesby amateur_programmer54 (Initiate)
|on Nov 09, 2012 at 03:58 UTC||Need Help??|
amateur_programmer54 has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to write a small Perl script to run an executable file. I want the .exe file to work on the entire contents of a data directory. I’d like to be able to run the final perl program on machines that run Windows XP or Windows 7.
The “System” command doesn’t seem to work for what I am doing and I must include both input and target file names and paths after the executable file name and I am attempting to mix paths with a variable from an array.
The program converts .MID files to .CSV files when run stand alone. Once I have edited the .CSV file I will convert it back to .MID format with another similar file.
The syntax I would use after a command prompt to convert one file at a time, is as follows:
C:\directory\midicsv.exe c:\path\input_file.mid c:\path\target_file.csv
I would like to keep the names of “input_file” and “target_file” the same other than the extension. “Input_file” may be a name that includes the character _
I am trying to convert files in batches. In order to do that I am capturing all the file names in a given data directory to an array, and was hoping to use the file names saved in the array as part of the input_file name string.
Below is what I have written so far. I am getting the following error: “C:midicsvmidicsv.exe’ is not recognized as an internal or external command.” What am I doing wrong?
Can I mix an array variable with a Path? If so can you give me the proper syntax? If not, how can I insert the filenames after the name of the .exe I am calling?
Can I rename all the files to similar names ending in .CSV, and establish an output path to a different directory?