perhaps an applescript that did the whole list and returned one list as a result... only one handoff.
Jim Ault Las Vegas On 4/21/07 12:17 AM, "John Craig" <[EMAIL PROTECTED]> wrote: > Thanks for the replies, everyone. I've written several handlers in the > past for things only to discover later that there is a command that does > the task in a one liner - I just never found it in the docs - so I > thought I'd ask. > > I'm recursing through a (sometimes large) list of files and folders > which can take a while, so I was trying to avoid another function call > per line. > > JC > > Josh Mellicker wrote: >> Here are a couple of handlers that return the "humanSize" (a nicely >> formatted version) of a file provided the complete file path and >> filename: >> >> >> put humanSize(tPathAndFile) into fld "file size" >> >> >> FUNCTION humanSize tPathAndFile >> put theFileDetail(tPathAndFile) into tFileDet >> put item 2 of tFileDet + item 3 of tFileDet into tSize >> IF tSize > 1000000 THEN >> set the numberformat to "##.##" >> return tSize/1000000 & " MB" >> ELSE >> set the numberformat to "##" >> return tSize/1000 & " KB" >> END IF >> END humanSize >> >> FUNCTION theFileDetail tPathAndFile >> set the itemdel to "/" >> put item -1 of tPathAndFile into tFile >> delete item -1 of tPathAndFile >> put "/" after tPathAndFile >> set the defaultfolder to tPathAndFile >> put the detailed files into tFiles >> filter tFiles with urlencode(tFile) & comma & "*" >> return tFiles >> END theFileDetail >> >> >> These only took a few days to write, I am not quite as fast as Richard >> :-) >> >> On Apr 20, 2007, at 7:02 PM, Richard Gaskin wrote: >> >>> John Craig wrote: >>> >>>> Richard Gaskin wrote: >>>>> John Craig wrote: >>>>>> Does anyone know of a native rev. method to obtain the size of a >>>>>> file without using shell or 'the detailed files'? >>>>> >>>>> What's the objection to using 'the detailed files'? >>>>> >>>>> It was added to the language specifically to provide what you're >>>>> looking for. >>>>> >>>> It's clumsy and long winded. >>> >>> Revolution allows you to write your own custom commands and >>> functions, so you can get the exact info you want in a call as simple >>> as: >>> >>> get FileSize(pFilePath) >>> >>> >>> Since it only takes a minute to write the dozen or so lines needed, >>> I'll go ahead and do that for you: >>> >>> function FileSize pPath >>> set the itemdel to "/" >>> put urlEncode(last item of pPath) into tShortFileName >>> 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 comma >>> put lineoffset( cr&tShortFileName&comma, cr&tFiles) into tLineNum >>> if tLineNum > 0 then >>> put line tLineNum of tFiles into tLine >>> return item 2 of tLine + item 3 of tLine >>> end if >>> end FileSize >>> >>> >>> Now you can drop than handy function into a library somewhere and use >>> it whenever you need it. >>> >>> -- Richard Gaskin >>> Fourth World Media Corporation >>> ___________________________________________________________ >>> [EMAIL PROTECTED] http://www.FourthWorld.com >>> _______________________________________________ >>> use-revolution mailing list >>> [email protected] >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-revolution >> >> _______________________________________________ >> use-revolution mailing list >> [email protected] >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution >> > > > _______________________________________________ > use-revolution mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
