Hi Ben

A solution could be:

In a MapBasic program use 

        iTable=TableInfo(Denver, TAB_INFO_TABFILE) 

to get the tables directory.

use

        Open File "C:\temp\mydoscom.bat" For Output as #1
and
            Print #1 ""+Left$(iTable,3)
to change the drive

            Print #1 "Dir *buffer* /s >c:\temp\Test.txt"
then
        Close file #1

Use this to run the batch file:

        Run Program "Shell32.exe C:\temp\mydoscom.bat"

Then use
            Dim k, m as integer
        Dim Lines(1) as string

        k=0

        Open file "c:\temp\Test.txt" For Input As #1

        Do while not EOT(1)
                k=k+1
        Loop

        Redim Lines(k)

        m=1

        Do while not EOT(1)
                Lines(m)=Line Input #1
                m=m+1
        Loop
        Close File #1

to read each line in the file to a variable.

Within each variable in Lines(#) search for ".TAB":

        Dim i as integer

        For i=1 to k
                    Dim A as String
                Dim Tablename(i) as string

                A=InStr(Lines(#),".tab"
                If Not A=0 then         '".TAB" is in the string
                        Tablename(i)=Mid$(stringvariable,40,A-1)
                        'column 40 is the starting column of the file name
if any
                End if
              Next

        '*******************************************

        Tablename(i) should now contain each table with the string "buffer"
(or something else).


        CBU  (Complex But Usable)


        Regards 

        Thomas Brix Lyng
        Frederikshavn County Administration
        Denmark
> ----------
> Fra:  Humphrey, Ben[SMTP:[EMAIL PROTECTED]]
> Sendt:        12. oktober 1999 23:34
> Til:  '[EMAIL PROTECTED]'
> Emne:         MI finding files in a windows directory whose name contain a
> specifi c string
> 
> Baby steps outside the mapinfo environment...
> 
> I was wondering if it is at all possible to somehow query the windows
> environment about the files contained in a specific directory.  The idea I
> had was that I would query a directory where an open table resides for a
> file containing a certain string in its name.
> 
> For example if I had denver.tab open from a certain directory I would want
> to search for any tables in that directory whose name contained the string
> "buffer"
> 
> Can it be done???
> 
> And since it has always been the case in the past, there will be a reward.
> This time, seeing that it is a more complex question, my first born child
> is
> up for grabs.
> 
> thanks,
> Ben
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
> 
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to