say it isn't so

RCS rcs at rcsprogramming.com
Sat Feb 1 08:16:01 EST 2003


Thanks for the replies and the code example...I guess I was just
complaining.

  If I parse the files in a repeat (checking the first item in each line)
and exit when I find it, it is fast enough. Sometimes I think in terms of
'toolbox' calls that we used to have to do direct manipulation on stuff...

JR


> RCS wrote:
>
> > Do I really have to do a 'files' function, and 'walk' through all of the
> > files (possibly hundreds) in the list until I find the one I am
intereted in
> > just to get the file 'type' and 'creator' on a Mac?
>
> Not if you have a couple minutes to turn it into a one-liner:
>
> function fwMacFileType pPath
>   local tSaveDir, tShortFileName, tFileList, tLine, tType
>   --
>   put the directory into tSaveDir
>   set the itemdel to "/"
>   put the last item of pPath into tShortFileName
>   delete last item of pPath
>   set the directory to pPath
>   put the detailed files into tFileList
>   put lineoffset(cr&urlEncode(tShortFileName)&comma, cr&tFileList&comma)
> into tLine
>   if tLine > 0 then
>     set the itemdel to comma
>     put last item of line tLine of tFileList into tType
>   end if
>   set the directory to tSaveDir
>   return tType
> end fwMacFileType
>
>
> --__--__--
>



> Well, it depends how do you know which file you are interested in. If
> you know the file name up front, then you can fetch the info
> directly. Otherwise, if you use some rules to determine which file is
> THE one to check, then I see no other way. Of course, you may be able
> to use your determination rules to either sort or search through the
> list of filenames to bring those of interest to top or extract them
> from the list, thus reducing your investigation to a subset of files.
>
> Robert
>
> --__--__--
>




More information about the metacard mailing list