FileInfo

Björnke von Gierke bvg at mac.com
Fri Feb 6 18:48:21 EST 2004


You could also try this:
lineoffset(tFile & ",",tFiles)
as the names are urlencoded, they show "%2C" instead of comma, so you 
know that you get the whole match.

On Freitag, Feb 6, 2004, at 21:45 Europe/Zurich, Zac Elston wrote:

> found a bug in the fileinfo function that was posted here a while back.
>
> the previous version was
>
>
> function FileInfo pPath
>    local tFile, tSaveDir, tFiles, tFileInfo
>    set the itemdel to "/"
>    put urlEncode(last item of pPath) into tFile
>    delete last item of pPath
>    put the directory into tSaveDir
>    set the directory to pPath
>    put the detailed files into tFiles
>    set the directory to tSaveDir
>    get lineoffset(tFile, tFiles)
>    if it > 0 then
>      return line it of tFiles
>    end if
> end FileInfo
>
> on
> get lineoffset(tFile, tFiles)
> a match will occur for files that are named with the same begining.
>
> so looking for the details of file.txt
> would match on the first occurance of file.txt , including file.txt.v1
>
> in my case, i'm scrapping webservers logs that are rotated nightly.
>
> so looking for access_log would match on access_log.$date
>
> while it's rare that this would occur for most others, the function 
> only
> matches on a substring not the entire filename
>
> so I just did  an item search.  anyone got a beter method?
>
> function FileInfo pPath
> --set the wholeMatches to true
> --that didn't help
>    local tFile, tSaveDir, tFiles, tFileInfo
>    set the itemdel to "/"
>    put urlEncode(last item of pPath) into tFile
>    delete last item of pPath
>    put the directory into tSaveDir
>    set the directory to pPath
>    put the detailed files into tFiles
>    set the directory to tSaveDir
>    set the itemdel to ","
>          repeat with x = 1 to the number of lines in tFiles
>     if item 1 of line x of tFiles  = tFile
>         then
>             return line x of tFiles
>         end if
>     end repeat
> end FileInfo
>
>
> -zac
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list