Re: Obtaining the size of a file
I agree, Jim - I certainly wouldn't have that many files in a single directory - they aren't mine and I don't create them. Jim Ault wrote: I have never seen 34000 files in one directory before, so I am not sure what to think. It might be more practical to look at a log file that the system creates when it modifies files. This might give you a short list immediately. Do the files change once they are created? It seems like 34000 files would not be changing all the time. Getting the list at the top of the hour might get you closer to you goal. Rev relies on shell or Applescript to handle single calls, so not much help for you. Jim Ault Las Vegas On 4/23/07 4:24 PM, "John Craig" <[EMAIL PROTECTED]> wrote: For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb RAM) which is not running any services. Time taken to get 'the detailed files'; 26888 millisecs = 26.888 seconds Size of output generated by rev for 'the detailed files'; 2543957 bytes = 2.5Mb On a busy server, the results could be considerably greater. The fact that it amounts to just under 0.8 millisecs per file is irrelevant - If I need a few (or a few hundred) file sizes, I still need to wait for the entire output to be generated. Economical? Richard Gaskin wrote: Turns out my test wasn't all that useful, since the OS has a bit of a bottleneck grabbing the info from 12,000+ files in a single directory. Running the same test on a folder that has only a few hundred files gives a per-file speed more on par with what we might expect: # File: 329 Total: 9ms Per file: 0.027356ms MacBook Pro, 2.16 GHz, 2MB RAM ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
I have never seen 34000 files in one directory before, so I am not sure what to think. It might be more practical to look at a log file that the system creates when it modifies files. This might give you a short list immediately. Do the files change once they are created? It seems like 34000 files would not be changing all the time. Getting the list at the top of the hour might get you closer to you goal. Rev relies on shell or Applescript to handle single calls, so not much help for you. Jim Ault Las Vegas On 4/23/07 4:24 PM, "John Craig" <[EMAIL PROTECTED]> wrote: > For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb > RAM) which is not running any services. > > Time taken to get 'the detailed files'; > 26888 millisecs = 26.888 seconds > > Size of output generated by rev for 'the detailed files'; > 2543957 bytes = 2.5Mb > > On a busy server, the results could be considerably greater. The fact > that it amounts to just under 0.8 millisecs per file is irrelevant - If > I need a few (or a few hundred) file sizes, I still need to wait for the > entire output to be generated. Economical? > > > > > Richard Gaskin wrote: >> Turns out my test wasn't all that useful, since the OS has a bit of a >> bottleneck grabbing the info from 12,000+ files in a single directory. >> >> Running the same test on a folder that has only a few hundred files >> gives a per-file speed more on par with what we might expect: >> >> # File: 329 Total: 9ms Per file: 0.027356ms >> >> MacBook Pro, 2.16 GHz, 2MB RAM >> > > > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John Craig wrote: > Richard Gaskin wrote: >> Turns out my test wasn't all that useful, since the OS has a >> bit of a bottleneck grabbing the info from 12,000+ files in >> a single directory. >> >> Running the same test on a folder that has only a few hundred files >> gives a per-file speed more on par with what we might expect: >> >> # File: 329 Total: 9ms Per file: 0.027356ms >> >> MacBook Pro, 2.16 GHz, 2MB RAM > > For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb > RAM) which is not running any services. > > Time taken to get 'the detailed files'; > 26888 millisecs = 26.888 seconds > > Size of output generated by rev for 'the detailed files'; > 2543957 bytes = 2.5Mb > > On a busy server, the results could be considerably greater. The > fact that it amounts to just under 0.8 millisecs per file is > irrelevant - If I need a few (or a few hundred) file sizes, I > still need to wait for the entire output to be generated. > Economical? Given that the biggest bottleneck here appears to be the OS itself, what do you propose which would be more economical? -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Shelling out to grab a single file took around 250 millisecs - although if multi file sizes are required, you can tack them all into the one command line and send that to the shell - it still takes about the same time. JC Bill Marriott wrote: And how long does it take for you to shell out a dir for the particular file you're interested in? "John Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb RAM) which is not running any services. Time taken to get 'the detailed files'; 26888 millisecs = 26.888 seconds Size of output generated by rev for 'the detailed files'; 2543957 bytes = 2.5Mb On a busy server, the results could be considerably greater. The fact that it amounts to just under 0.8 millisecs per file is irrelevant - If I need a few (or a few hundred) file sizes, I still need to wait for the entire output to be generated. Economical? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
And how long does it take for you to shell out a dir for the particular file you're interested in? "John Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb RAM) which is not running any services. Time taken to get 'the detailed files'; 26888 millisecs = 26.888 seconds Size of output generated by rev for 'the detailed files'; 2543957 bytes = 2.5Mb On a busy server, the results could be considerably greater. The fact that it amounts to just under 0.8 millisecs per file is irrelevant - If I need a few (or a few hundred) file sizes, I still need to wait for the entire output to be generated. Economical? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
For only 1 folder containing 34,782 files on MY machine (3GHz, 512Mb RAM) which is not running any services. Time taken to get 'the detailed files'; 26888 millisecs = 26.888 seconds Size of output generated by rev for 'the detailed files'; 2543957 bytes = 2.5Mb On a busy server, the results could be considerably greater. The fact that it amounts to just under 0.8 millisecs per file is irrelevant - If I need a few (or a few hundred) file sizes, I still need to wait for the entire output to be generated. Economical? Richard Gaskin wrote: Turns out my test wasn't all that useful, since the OS has a bit of a bottleneck grabbing the info from 12,000+ files in a single directory. Running the same test on a folder that has only a few hundred files gives a per-file speed more on par with what we might expect: # File: 329 Total: 9ms Per file: 0.027356ms MacBook Pro, 2.16 GHz, 2MB RAM ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Ken, I'll just buy a brand new set of typing gloves :-) Ken Ray wrote: On Mon, 23 Apr 2007 09:55:25 +0100, John Craig wrote: Thanks for the info. I am just of the opinion that the file functions in rev could possibly be more economical - it's as easy as that. I agree, John... it would be great for Rev to have a "file" object that had properties that could be retrieved: put the fileSize of file into tSize put the visible of file into tVis (etc.) But until RunRev makes that happen, we've got to type a bit more to get the job done... Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Turns out my test wasn't all that useful, since the OS has a bit of a bottleneck grabbing the info from 12,000+ files in a single directory. Running the same test on a folder that has only a few hundred files gives a per-file speed more on par with what we might expect: # File: 329 Total: 9ms Per file: 0.027356ms MacBook Pro, 2.16 GHz, 2MB RAM -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com Richard Gaskin wrote: Test: Make a stack with one button containing the script below, and one field named "r". I set the tabstops of the field to 300, and turned on the vGrid and hGrid for column cropping. Result: # Files: 12883 Total: 3650ms Per file: 0.283319ms Code: on mouseUp -- Get folder: answer folder "Select a folder:" if it is empty then exit to top -- -- Run function, with timing: put the millisecs into t put FileListInfo(it) into tmp put the millisecs - t into t -- -- Display function result in field, and test result in Msg: put tmp into fld "r" put the number of lines of fld "r" into n put "# File: "&n&" Total: "&t &"ms Per file: "& t/n &"ms" end mouseUp function FileListInfo pDir -- Get list of file info: put the directory into tSaveDir set the directory to pDir put the detailed files into tFileList set the directory to tSaveDir -- Parse for display: put empty into tFileInfo repeat for each line tLine in tFileList put urlDecode(item 1 of tLine) &tab& \ item 2 of tLine + item 3 of tLine &cr after tFileInfo end repeat -- return tFileInfo end FileListInfo ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
No objections - I was simply looking for a possible native rev answer. Every day's a school day and - sometimes - if you don't ask, you don't find out! Bill Marriott wrote: John, I hate to keep the thread going, but what was the objection to using a shell call? You can easily get a directory listing with filters and even hide the shell window ... might be faster than the other approaches if you're talking about a huge list of "the detailed files." And, instead of calling it once every iteration of a loop, you could do a "dir /s" to grab a whole tree and then process it with Rev's chunk expressions before you start looping. - Bill "John Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, Stephen. I'm very comfortable with rev. It became my 'weapon of choice' very quickly once I discovered it. economic: using the minimum of time or resources necessary for effectiveness One example is needing the size of a file in a folder of thousands. Creating the output generated by 'the files' is not economical in this case. However, as discussed in the thread, the same output can facilitate a speedy routine if the entire output is required. Both have merit. I had already 'rolled my own' as I didn't see another option, but wondered if there was another way I hadn't discovered - hence the original post. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John Craig wrote: One example is needing the size of a file in a folder of thousands. Creating the output generated by 'the files' is not economical in this case. Test: Make a stack with one button containing the script below, and one field named "r". I set the tabstops of the field to 300, and turned on the vGrid and hGrid for column cropping. Result: # Files: 12883 Total: 3650ms Per file: 0.283319ms Code: on mouseUp -- Get folder: answer folder "Select a folder:" if it is empty then exit to top -- -- Run function, with timing: put the millisecs into t put FileListInfo(it) into tmp put the millisecs - t into t -- -- Display function result in field, and test result in Msg: put tmp into fld "r" put the number of lines of fld "r" into n put "# File: "&n&" Total: "&t &"ms Per file: "& t/n &"ms" end mouseUp function FileListInfo pDir -- Get list of file info: put the directory into tSaveDir set the directory to pDir put the detailed files into tFileList set the directory to tSaveDir -- Parse for display: put empty into tFileInfo repeat for each line tLine in tFileList put urlDecode(item 1 of tLine) &tab& \ item 2 of tLine + item 3 of tLine &cr after tFileInfo end repeat -- return tFileInfo end FileListInfo -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John, I hate to keep the thread going, but what was the objection to using a shell call? You can easily get a directory listing with filters and even hide the shell window ... might be faster than the other approaches if you're talking about a huge list of "the detailed files." And, instead of calling it once every iteration of a loop, you could do a "dir /s" to grab a whole tree and then process it with Rev's chunk expressions before you start looping. - Bill "John Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, Stephen. I'm very comfortable with rev. It became my 'weapon of choice' very quickly once I discovered it. economic: using the minimum of time or resources necessary for effectiveness One example is needing the size of a file in a folder of thousands. Creating the output generated by 'the files' is not economical in this case. However, as discussed in the thread, the same output can facilitate a speedy routine if the entire output is required. Both have merit. I had already 'rolled my own' as I didn't see another option, but wondered if there was another way I hadn't discovered - hence the original post. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Hi, Stephen. I'm very comfortable with rev. It became my 'weapon of choice' very quickly once I discovered it. economic: using the minimum of time or resources necessary for effectiveness One example is needing the size of a file in a folder of thousands. Creating the output generated by 'the files' is not economical in this case. However, as discussed in the thread, the same output can facilitate a speedy routine if the entire output is required. Both have merit. I had already 'rolled my own' as I didn't see another option, but wondered if there was another way I hadn't discovered - hence the original post. JC Stephen Barncard wrote: Thanks for the info. I am just of the opinion that the file functions in rev could possibly be more economical - it's as easy as that. By Economical, do you mean a command for every variation? The problem with that is that the more definitions that are in the message path, the slower Rev gets. If Rev made up a specific function for everything, Rev might not perform as well, not to mention the cross-platform sync, documentation and bug issues. I quite like it that Rev gives us the 'primitives' sometimes with these things where we might want to 'roll our own' and quite frankly, I look forward to writing efficient functions and handlers to do what I need with the data. Once you get comfortable with Rev, you'll make up your own libraries for what you need to do that stock Rev can't. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Thanks for the info. I am just of the opinion that the file functions in rev could possibly be more economical - it's as easy as that. By Economical, do you mean a command for every variation? The problem with that is that the more definitions that are in the message path, the slower Rev gets. If Rev made up a specific function for everything, Rev might not perform as well, not to mention the cross-platform sync, documentation and bug issues. I quite like it that Rev gives us the 'primitives' sometimes with these things where we might want to 'roll our own' and quite frankly, I look forward to writing efficient functions and handlers to do what I need with the data. Once you get comfortable with Rev, you'll make up your own libraries for what you need to do that stock Rev can't. -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
On Mon, 23 Apr 2007 09:55:25 +0100, John Craig wrote: > Thanks for the info. I am just of the opinion that the file > functions in rev could possibly be more economical - it's as easy as > that. I agree, John... it would be great for Rev to have a "file" object that had properties that could be retrieved: put the fileSize of file into tSize put the visible of file into tVis (etc.) But until RunRev makes that happen, we've got to type a bit more to get the job done... Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Thanks for the info. I am just of the opinion that the file functions in rev could possibly be more economical - it's as easy as that. Chipp Walters wrote: Hi John, I'm coming rather late to this party. But it does appear you're missing something important here. I assume you're new to programming. Here's how historically it's worked in the past. People have used programs to write other programs, and in doing so, they create functions and handlers (or objects, methods and procedures) which help them do many different things. One of the really cool things about programming is the ability to create new code from existing code. So, what Richard did so kindly for you, was to create a universal function which when called correctly via one-line, would return exactly what you wanted-- namely the filesize. This is how many of us program in Rev. We create 'libraries' of these functions, and then can access them via one or two line calls. I hope this helps you in better understanding programming concepts. You are welcome to peruse the free files and tutorials I host at: http://www.altuit.com/webs/altuit2/RunRev/default.htm You can also find some good tips of mine at www.revcentral.com, though I haven't sent out a newsletter in awhile...need to get on that ;-) Also, Richard hosts many great files and tips at at: www.fourthworld.com including 'devolution' a mostly complete IDE written totally in Transcript. Furthermore, Richard also hosts the website www.revjournal.com which also has many fine articles on how to program in Rev. Good luck! best regards, Chipp ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Hi John, I'm coming rather late to this party. But it does appear you're missing something important here. I assume you're new to programming. Here's how historically it's worked in the past. People have used programs to write other programs, and in doing so, they create functions and handlers (or objects, methods and procedures) which help them do many different things. One of the really cool things about programming is the ability to create new code from existing code. So, what Richard did so kindly for you, was to create a universal function which when called correctly via one-line, would return exactly what you wanted-- namely the filesize. This is how many of us program in Rev. We create 'libraries' of these functions, and then can access them via one or two line calls. I hope this helps you in better understanding programming concepts. You are welcome to peruse the free files and tutorials I host at: http://www.altuit.com/webs/altuit2/RunRev/default.htm You can also find some good tips of mine at www.revcentral.com, though I haven't sent out a newsletter in awhile...need to get on that ;-) Also, Richard hosts many great files and tips at at: www.fourthworld.com including 'devolution' a mostly complete IDE written totally in Transcript. Furthermore, Richard also hosts the website www.revjournal.com which also has many fine articles on how to program in Rev. Good luck! best regards, Chipp ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Apology accepted. Richard Gaskin wrote: Sorry if my attempt to help you find an immediate solution struck you as "bizarre". ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John Craig wrote: It's an app where files and folders are selected as part of a backup process. Folders can be selected, in which case the entire folder contents would be used. In the case of individual files (or just a few) selected in any given folder, only info for those specific files are required. The app should be capable of running on a basic (possibly ancient) machine, so any speed improvements are a bonus. I appreciate all the responses - they are helpful and useful, but you seem a bit over protective of rev for some bizarre reason - Not Rev, just your time. At a quarter-millisecond per access, even the slowest method shown here may not be bad. And if this needs to work on multiple files there are ways to speed it up exponentially. If you took the time to write your own external, unless it does something highly specific on a whole directory at a time, I suspect the net runtime would be roughly on par with what you can get in native Transcript in a fraction of the effort. I've been down this road before, most recently with an installer I'm working on for some of my clients. I've sliced and diced this problem from a few different angles, and the recommendation I offered to you was the result of that effort. Sorry if my attempt to help you find an immediate solution struck you as "bizarre". Best of luck - -- Richard Gaskin Fourth World Media Corporation ___ [EMAIL PROTECTED] http://www.FourthWorld.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
The ls command can access just 1 file by naming it. JC Stephen Barncard wrote: I think, at least in MacOSX, that this is just the form any application gets this information', including the finder. It looks very suspiciously like the dump you get when you type "ls -l" in the terminal window. Something has to 'waste the time' getting this informationbe it rev, the command line or another app. Maybe I should have said 'another lengthy function call per line'... I already use a cached file list, but if I hit a folder with thousands of files in it and only need the size of 1 file in that particular folder, it seems like wasted CPU time to pull the entire folder contents. Richard Gaskin wrote: John Craig wrote: 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. A perfect case for using "the detailed files", so you can rapidly get all of the size info for an entire directory in one call, and the just format the info or calculate it however you need. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
It's an app where files and folders are selected as part of a backup process. Folders can be selected, in which case the entire folder contents would be used. In the case of individual files (or just a few) selected in any given folder, only info for those specific files are required. The app should be capable of running on a basic (possibly ancient) machine, so any speed improvements are a bonus. I appreciate all the responses - they are helpful and useful, but you seem a bit over protective of rev for some bizarre reason - I can't think why anyone would argue against having a concise one line function call for something this basic. Looking at how this thread turned out from a question where the answer appears to be 'No' now makes me think that the detailed files isn't so long winded after all :-) This link may help you to relax a bit ;-) http://www.emanator.demon.co.uk/bigclive/tickle.htm Have fun, JC Richard Gaskin wrote: John Craig wrote: Maybe I should have said 'another lengthy function call per line'... I already use a cached file list, but if I hit a folder with thousands of files in it and only need the size of 1 file in that particular folder, it seems like wasted CPU time to pull the entire folder contents. Maybe, and maybe not. I thought I'd read a recent post from you where you'd said you needed this info for thousands of files across multiple directories, no? If so, while the overhead of the function call is modest for a single file (and might be made faster with your Bugzilla request for a one-liner -- what's that BZ #?), if you need to do this for every file in a directory then obtaining all of that info in one call would seem rather ideal, yes? Can you tell us a bit more about this circumstance in which you need to obtain this information for thousands of file in a directory, but not all at once, and in a context in which the roughly quarter of a millisecond even my long version takes would be prohibitive? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
I think, at least in MacOSX, that this is just the form any application gets this information', including the finder. It looks very suspiciously like the dump you get when you type "ls -l" in the terminal window. Something has to 'waste the time' getting this informationbe it rev, the command line or another app. Maybe I should have said 'another lengthy function call per line'... I already use a cached file list, but if I hit a folder with thousands of files in it and only need the size of 1 file in that particular folder, it seems like wasted CPU time to pull the entire folder contents. Richard Gaskin wrote: John Craig wrote: 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. A perfect case for using "the detailed files", so you can rapidly get all of the size info for an entire directory in one call, and the just format the info or calculate it however you need. -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John Craig wrote: Maybe I should have said 'another lengthy function call per line'... I already use a cached file list, but if I hit a folder with thousands of files in it and only need the size of 1 file in that particular folder, it seems like wasted CPU time to pull the entire folder contents. Maybe, and maybe not. I thought I'd read a recent post from you where you'd said you needed this info for thousands of files across multiple directories, no? If so, while the overhead of the function call is modest for a single file (and might be made faster with your Bugzilla request for a one-liner -- what's that BZ #?), if you need to do this for every file in a directory then obtaining all of that info in one call would seem rather ideal, yes? Can you tell us a bit more about this circumstance in which you need to obtain this information for thousands of file in a directory, but not all at once, and in a context in which the roughly quarter of a millisecond even my long version takes would be prohibitive? -- Richard Gaskin Fourth World Media Corporation ___ [EMAIL PROTECTED] http://www.FourthWorld.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Maybe I should have said 'another lengthy function call per line'... I already use a cached file list, but if I hit a folder with thousands of files in it and only need the size of 1 file in that particular folder, it seems like wasted CPU time to pull the entire folder contents. Richard Gaskin wrote: John Craig wrote: 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. A perfect case for using "the detailed files", so you can rapidly get all of the size info for an entire directory in one call, and the just format the info or calculate it however you need. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
On 4/21/07 1:03 AM, "Bill Marriott" <[EMAIL PROTECTED]> wrote: > Another way to make quick work of the detailed files is to put them into an > array: > >put the detailed files into foobar >split foobar by return and comma > > then you can say, > >get item 1 of foobar[urlencode(myFileName)] > > to obtain the file size. How's that for a one-liner? You can include the size of the Mac data fork and still use just one line: get sum(item 1 to 2 of foobar[urlencode(myFileName)]) -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
This is an example from documentation, assuming your file is MyFile.txt: get the detailed files filter it with "MyFile.txt,*" put item 2 of it + item 3 of it into myFileSize There is also size property which reports the amount of disk space taken by an object to judge how much memory an object takes when displayed. E.g.: get the size of image myImage However the size property of a stack does not report any meaningful value and is always 1. All the best! Viktoras ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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 > 100 THEN >> set the numberformat to "##.##" >> return tSize/100 & " 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 >>> use-revolution@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-revolution >> >> ___ >> use-revolution mailing list >> use-revolution@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution >> > > > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John, 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. Josh's function is pretty speedy. And, if you know you are going to process all the files in a directory, then you can store a copy of the detailed files before filtering for the specific file you want. 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 [...] Another way to make quick work of the detailed files is to put them into an array: put the detailed files into foobar split foobar by return and comma then you can say, get item 1 of foobar[urlencode(myFileName)] to obtain the file size. How's that for a one-liner? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
John Craig wrote: 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. A perfect case for using "the detailed files", so you can rapidly get all of the size info for an entire directory in one call, and the just format the info or calculate it however you need. -- Richard Gaskin Fourth World Media Corporation ___ [EMAIL PROTECTED] http://www.FourthWorld.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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 > 100 THEN set the numberformat to "##.##" return tSize/100 & " 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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
This does not use shell, but similar. Another way that might help someone out there is to: on mousedoubleup answer file "choose a file" put fileSizeK(it) && "K" into msg end mousedoubleup function fileSizeK pathFN put quote into q get revMacFromUnixPath(pathFN) get ("tell app "&q&"Finder"&q&" to return the size of alias "&q& it &q) do it as applescript return (the result div 1000) end fileSizeK Jim Ault Las Vegas On 4/20/07 5:50 PM, "John Craig" <[EMAIL PROTECTED]> wrote: > Some of the files may be very large - making this method too slow. > > Mark Smith wrote: >> Well, I guess the detailed files actually is the native rev method, >> but this works: >> >> on mouseUp >> put "/Users/marksmith/Desktop/add.tiff" into tUrl >> put length (URL ("binfile:/Users/marksmith/Desktop/add.tiff")) >> end mouseUp >> >> Of course, it means reading the whole file into memory, which might >> not always be ideal. >> >> Best, >> >> Mark >> >> On 20 Apr 2007, at 23:32, 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'? >>> >>> Thanks, >>> >>> JC >>> >>> ___ >>> use-revolution mailing list >>> use-revolution@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-revolution >> >> >> ___ >> use-revolution mailing list >> use-revolution@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution >> > > > ___ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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 > 100 THEN set the numberformat to "##.##" return tSize/100 & " 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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
At 1:45 AM +0100 4/21/07, John Craig wrote: It's clumsy and long winded. I don't think so. One can easily craft a handler to get whatever info one needs from this listing using chunk expressions... 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. -- stephen barncard s a n f r a n c i s c o - - - - - - - - - - - - ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Some of the files may be very large - making this method too slow. Mark Smith wrote: Well, I guess the detailed files actually is the native rev method, but this works: on mouseUp put "/Users/marksmith/Desktop/add.tiff" into tUrl put length (URL ("binfile:/Users/marksmith/Desktop/add.tiff")) end mouseUp Of course, it means reading the whole file into memory, which might not always be ideal. Best, Mark On 20 Apr 2007, at 23:32, 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'? Thanks, JC ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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. :-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
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. -- Richard Gaskin Fourth World Media Corporation ___ [EMAIL PROTECTED] http://www.FourthWorld.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Obtaining the size of a file
Well, I guess the detailed files actually is the native rev method, but this works: on mouseUp put "/Users/marksmith/Desktop/add.tiff" into tUrl put length (URL ("binfile:/Users/marksmith/Desktop/add.tiff")) end mouseUp Of course, it means reading the whole file into memory, which might not always be ideal. Best, Mark On 20 Apr 2007, at 23:32, 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'? Thanks, JC ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Obtaining the size of a file
Does anyone know of a native rev. method to obtain the size of a file without using shell or 'the detailed files'? Thanks, JC ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution