Computing.Net > Forums > Programming > Help with Script to process files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help with Script to process files

Reply to Message Icon

Name: cranky_pants
Date: January 9, 2007 at 08:01:22 Pacific
OS: Win2k3
CPU/Ram: intel 2gig
Product: dell
Comment:

Hello,

I'm looking for some help with creating a script (of any flavor) that will accomplish the following:

I have a vendor supplied executable that processes text files based on the name of the text file. The text filename is an argument that can be given to the executable. When this is run, it creates a log file and reject file. This is great if I have one text file that needs to be processed now and then, but I will have several of these txt files generated every hour. I need the ability to envoke the executable to process new txt files that will have a time stamp (making them unique), and save the log\reject for each txt file processed.

I can't tell the executable to simply process *.txt...it does not like that.

Any and all help would be greatly appreciated!!




Sponsored Link
Ads by Google

Response Number 1
Name: StreamLogic
Date: January 11, 2007 at 08:23:39 Pacific
Reply:

cranky_pants,

I personally would use VBScript on a Windows platform. Without writing the entire script, here are the steps I'd take:

1) Create a .vbs file using notepad
2) Use the FileSystemObject to open a folder, and "look" for files within that folder
3) When file(s) are found, process them with the executable by calling a Shell.Run on the executable.
4) Once this .vbs is written, schedule it with Windows Scheduler (scheduled tasks).

Hope this helps,
Curtis


Curtis Hughes
StreamLogic Inc.
http://www.streamlogicinc.com


0

Response Number 2
Name: Mechanix2Go
Date: January 11, 2007 at 08:35:24 Pacific
Reply:

If it's simply a matter of getting the exe to act on each txt file:

::== mp.bat
@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims=" %%A in ('dir /b *.txt') do (
myprog %%A
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: Mechanix2Go
Date: January 11, 2007 at 16:01:38 Pacific
Reply:

If you need to track which have been done and not do any one twice, try this:

::== m3.bat
@echo off >> done.log
setLocal EnableDelayedExpansion

for /f "tokens=* delims=" %%A in ('dir /b *.txt') do (
find "%%A" < done.log > nul
if errorlevel 1 call :sub1 %%A
)
goto :eof

:sub1
echo %* >> done.log
echo prog %*
goto :eof


=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Help with Script to process files

Help : Bash script to access all fi www.computing.net/answers/programming/help-bash-script-to-access-all-fi/12080.html

script to copy files from a server www.computing.net/answers/programming/script-to-copy-files-from-a-server-/16825.html

Script to merge files in one www.computing.net/answers/programming/script-to-merge-files-in-one/17116.html