James,
Thanks for the info. I was aware of the FIND command but not the FINDSTR. The latter seems to have several more options. I will give it a try. -Bob ----- Original Message ----- From: "James Bentley" <[email protected]> To: "RBASE-L Mailing List" <[email protected]> Sent: Tuesday, November 10, 2009 2:58:53 PM GMT -06:00 US/Canada Central Subject: [RBASE-L] - Re: Searching for file contents Bob I ofter use and old Norton utility "TS" text seach. to do what you want. In place of this you might consider using the Windows command line utility FINDSTR. This utility can do a "literal" search or a "regular expression" search. Try the following FINDSTR /I /M /C:"your search term" *.* > output.log The output is a list of filenames you could them import the output.log file into a temporary table /I ignores case /M only list filenames where there is a match /C: is the literal string you are searching for in " " *.* may need a path qualifier output.log could be any file name. You could even use the rbase command FILENAME(0) to generate a file name for you You could always create a permanent batch file and pass the search string and output file name as parameters or you could write out a BAT file each time. RBase ZIP command is still involved Jim Bentley American Celiac Society [email protected] tel: 1-504-737-3293 From: "[email protected]" <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Tue, November 10, 2009 11:39:43 AM Subject: [RBASE-L] - Re: Searching for file contents Thank you to all who replied. I think I need to explain a bit further. First I am not needing to replace strings, but simply find what files may contain a string. We recieve documents via EDI that contain several types of information, such as Purchase Orders, Advanced Ship Notices, Invoices, etc. etc. These documents come in through an AS2 or VAN (ftp) connection and are processed continously, 24 hours per day. The file names that these documents come in have no relevance to what they are. Usually the format is YYYYMMDDxxx.xxx with x being a sequential number. However, the format does differ from various sources. So a PO and an Invoice document is not dicernable by the file name. On occasion, a user will need to look at the raw data (i.e. the YYYYMMDDxxx.xxx or whatever file) that a certain PO, Invoice, ASN etc. came in on. It may be 2 or 3 days later for example and hundreds of files have been recieved in since. I want to create a button that a user can enter a PO number, invoice number etc. and the program do a search through several hundred files and find the one desired. Therefore I need to be able to search the contents of hundreds of files residing in an Archive Folder for a specific string such as PO number. Once found, I would then open the specific file automatically for review by the user. This could be done by using the Windows Search option and manually opening the file, but I am wanting it to be an option within my application. The key here is that a typical search will be going through hundreds of files and needs to be a very efficient method. Hopefully this better explains my requirement. Thanks, -Bob ----- Original Message ----- From: "MikeB" <[email protected]> To: "RBASE-L Mailing List" <[email protected]> Sent: Tuesday, November 10, 2009 9:17:29 AM GMT -06:00 US/Canada Central Subject: [RBASE-L] - Re: Searching for file contents You can set the file as a VarChar and use SLOC to determine if the string value is in the file. Set var VFile VarChar = ['TheFullPathNameOfTheFile'] set var vSloc integer = (SLOC(.VFile, 'ST*856*123')) if vSloc > 0 then pause 2 using '"ST*856*123" found in current file' else pause 2 using 'No Matching String in current file' endif ----- Original Message ----- From: <[email protected]> To: "RBASE-L Mailing List" <[email protected]> Sent: Tuesday, November 10, 2009 10:03 AM Subject: [RBASE-L] - Searching for file contents In Windows you can search for a specific text string in all files for a folder(s). DOS has a similar FIND command. I need to be able to execute this function from within Rbase. Say there are 100 files in a folder and I need to find the one that has "ST*856*123" in it. I can ZIP a FIND command, output the results to a text file, load the text file into Rbase and then parse the temp table to see if the string was found. Any better ideas on how to accomplish this? Thanks, -Bob

