EchoAlertcom
IS-IT--Management
Hello,
I have a script that parses a text file and depending on the content of each line, it will write that line to the appropriate text file. I have this working great now (thanks to members of this group on Tek-tips).
The next task that I'm stuck on is having the script parse one file after the next in a loop. Right now it is set up for the user to select a file from the list and click submit. The user has to do this for each file in the directory where these files reside. There is no reason they can't start the script once and have it go to the first file in the directory, parse it and then go to the next and parse it until there are no more files in the directory.
Can someone suggest an over structure for this? I'm not sure how to make the loop find the next file from the one it had in the last iteration. The file names are always different but to make it easy i listed them as below.
I have what the parsing does finished I'm only looking for help with looping through the files in the directory automatically.
For example:
I would need it to parse the following files.
C:\inetpub\intranet\files\text1.txt
C:\inetpub\intranet\files\text2.txt
C:\inetpub\intranet\files\text3.txt
Warmest Regards,
Steve
I have a script that parses a text file and depending on the content of each line, it will write that line to the appropriate text file. I have this working great now (thanks to members of this group on Tek-tips).
The next task that I'm stuck on is having the script parse one file after the next in a loop. Right now it is set up for the user to select a file from the list and click submit. The user has to do this for each file in the directory where these files reside. There is no reason they can't start the script once and have it go to the first file in the directory, parse it and then go to the next and parse it until there are no more files in the directory.
Can someone suggest an over structure for this? I'm not sure how to make the loop find the next file from the one it had in the last iteration. The file names are always different but to make it easy i listed them as below.
I have what the parsing does finished I'm only looking for help with looping through the files in the directory automatically.
For example:
I would need it to parse the following files.
C:\inetpub\intranet\files\text1.txt
C:\inetpub\intranet\files\text2.txt
C:\inetpub\intranet\files\text3.txt
Warmest Regards,
Steve