On 12 Nov 98 at 21:28, David Coulthart wrote:
> Basically what I would like to do is perform:
>
> DIR sol.exe /s /b > output.txt
>
> & then I would like to have the batch file read in each line from the
> text file performing:
>
> DEL "line of output.txt"
>
> My problem, however, is that I do not know how to have the batch file
> read in a line from the file & then output it to a line with the DEL
> command in front of it & quotes around it (for compatibility with Win95
> long file names)
>
> If someone has any suggestions I would greatly appreciate it. The other
> approach I was considering was using some of my basic knowledge of C++
> to develop the program, b/c reading files is much easier that way, but I
> don't have any idea how to execute the necessary DOS commands to
> generate the directory listings or delete the file from within the C++
> program.
In the Olde Days, I used EDLIN for jobs like this; I'd use DIR or
whatever to build a text file, and feed EDLIN the file and a script
to turn it into a batch file that did exactly what I needed.
Life is easier now: We can use Perl on Win32. [My preferred
beginner Perl book has a blue and white cover, and says something
about "Start this book a beginner and finish it a pro".
Unfortunately, I recently moved cubicles and it's in one of these
boxes....]
My rough estimate is that a job like this can be done in Perl with
between a tenth and a one-hundredth of the programming effort that
C++ would take. Obviously there's going to be some overhead on your
first project as you learn the language, but this job only needs
three features: executing system commands, reading lines of a text
file, and string concatenation (to build the DEL command line).
David G
PCSOFT's List Owner's:
Bob Wright<[log in to unmask]>
Drew Dunn<[log in to unmask]>
|