Folder size

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Folder size

Chris Carroll-Davis
Hello folks -

Anyone know if there is an easy way in Rev of getting the size of a  
folder (together with all it's sub-folders).  I know I can do a loop  
using "detailed files" and "detailed folders" but that seems a bit  
long-winded, and I'm sure I'd be re-inventing the wheel!  Is there  
another way, or is there an existing function anywhere that I can pinch?

TIA

Chris


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Folder size

xbury.cs
Chris,

Is this for Mac or PC?

If it is for PC, there's a utility called "diruse.exe" in the Moft
Resource kit that does this
quite nicely...

cheers
Xavier

On 12/07/2005 17:17:56 use-revolution-bounces wrote:

>Hello folks -
>
>Anyone know if there is an easy way in Rev of getting the size of a
>folder (together with all it's sub-folders).  I know I can do a loop
>using "detailed files" and "detailed folders" but that seems a bit
>long-winded, and I'm sure I'd be re-inventing the wheel!  Is there
>another way, or is there an existing function anywhere that I can pinch?
>
>TIA
>
>Chris
>
>
>_______________________________________________
>use-revolution mailing list
>[hidden email]
>Please visit this url to subscribe, unsubscribe and manage your
subscription
>preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution


-----------------------------------------
Visit us at http://www.clearstream.com
                                                         
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents of
this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you are
not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. Any views expressed in this e-mail are
those of the individual sender, except where the sender specifically
states them to be the views of Clearstream International or of any of
its affiliates or subsidiaries.

END OF DISCLAIMER
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Folder size

Chris Carroll-Davis
Xavier -

Thanks for the tip.

Iit's for both Mac & PC really - but mainly mac at the moment.  Since  
posting, I've found that I can get the info I need with applescript -  
"Tell application "Finder" ... return physical size of folder  
"Folderpath"  ... End tell", but of course that's no good for PC.  I  
could look at your suggestion, but I need this to run on any machine  
- i.e. I can't rely on any other software being installed.   :-(

Looks like I might have to bite the bullet and do it with transcript  
eventually. Yuk.  I know for a decent programmer it is an easy job,  
but I'm getting old and brain is slow!

Thanks

Chris



On 13 Jul 2005, at 08:25, [hidden email] wrote:

> Chris,
>
> Is this for Mac or PC?
>
> If it is for PC, there's a utility called "diruse.exe" in the Moft
> Resource kit that does this
> quite nicely...
>
> cheers
> Xavier
>
> On 12/07/2005 17:17:56 use-revolution-bounces wrote:
>
>> Hello folks -
>>
>> Anyone know if there is an easy way in Rev of getting the size of a
>> folder (together with all it's sub-folders).  I know I can do a loop
>> using "detailed files" and "detailed folders" but that seems a bit
>> long-winded, and I'm sure I'd be re-inventing the wheel!  Is there
>> another way, or is there an existing function anywhere that I can  
>> pinch?
>>
>> TIA
>>
>> Chris
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>>
> subscription
>
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
>
> -----------------------------------------
> Visit us at http://www.clearstream.com
>
> IMPORTANT MESSAGE
>
> Internet communications are not secure and therefore Clearstream
> International does not accept legal responsibility for the contents of
> this message.
>
> The information contained in this e-mail is confidential and may be
> legally privileged. It is intended solely for the addressee. If you  
> are
> not the intended recipient, any disclosure, copying, distribution or
> any action taken or omitted to be taken in reliance on it, is
> prohibited and may be unlawful. Any views expressed in this e-mail are
> those of the individual sender, except where the sender specifically
> states them to be the views of Clearstream International or of any of
> its affiliates or subsidiaries.
>
> END OF DISCLAIMER
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Folder size

Eric Chatonet
Hello Chris,

Here is a piece of code (from Frederic Rinaldi I think) which can get  
you started:
Params:
theFolder: path to the root folder you want to scan
addFullPath : boolean to get absolute (true) or relative path (false)
allInfos : boolean to get all information (true) or path only (false)

item 2 & 3 in the returned list with allInfos=true are the file size  
(data fork with Mac OS) and the resource fork size (Mac OS only, 0  
for others)

function AllFiles theFolder,addFullPath,allInfos
   --returns full path of all enclosed files
   local startFolder
   set cursor to busy
   if last char of theFolder is not "/"
   then put "/" after theFolder
   if startFolder is empty
   then put theFolder into startFolder

   set the defaultFolder to theFolder
   if the result is not empty
   then
     beep
     answer error "Répertoire inexistant:" & return & return &  
theFolder titled "Erreur"
     exit to top
   end if

   put the detailed files into filesList
   filter filesList without ".*"
   filter filesList without "Icon%0D*"
   filter filesList without "*,MACSfdrp" -- remove folder aliases

   put the folders into foldersList
   filter foldersList without ".*"

   repeat for each line loopFolder in foldersList
     put AllFiles(thefolder & loopFolder & "/",addFullPath,allInfos)  
& return after resultList
   end repeat

   repeat with i=number of lines of filesList down to 1
     -- set cursor to busy
     if addFullPath
     then put MyURLEncode(theFolder) before line i of filesList
     if allInfos = false
     then put item 1 of line i of filesList into line i of filesList
   end repeat

   get resultList & filesList
   sort lines of it
   return word 1 to -1 of it -- strip empty lines
end AllFiles
------------------
function MyURLEncode what
   put URLEncode(what) into what
   replace "%2F" with "/" in what
   return what
end MyURLEncode

Le 13 juil. 05 à 10:15, Chris Carroll-Davis a écrit :

> Iit's for both Mac & PC really - but mainly mac at the moment.  
> Since posting, I've found that I can get the info I need with  
> applescript - "Tell application "Finder" ... return physical size  
> of folder "Folderpath"  ... End tell", but of course that's no good  
> for PC.  I could look at your suggestion, but I need this to run on  
> any machine - i.e. I can't rely on any other software being  
> installed.   :-(
>
> Looks like I might have to bite the bullet and do it with  
> transcript eventually. Yuk.  I know for a decent programmer it is  
> an easy job, but I'm getting old and brain is slow!
>
> Thanks
>
> Chris
>>
>>> Hello folks -
>>>
>>> Anyone know if there is an easy way in Rev of getting the size of a
>>> folder (together with all it's sub-folders).  I know I can do a loop
>>> using "detailed files" and "detailed folders" but that seems a bit
>>> long-winded, and I'm sure I'd be re-inventing the wheel!  Is there
>>> another way, or is there an existing function anywhere that I can  
>>> pinch?


Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        [hidden email]/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Folder size

Chris Carroll-Davis
Eric -

thanks very much!  Yes, this is exactly what I need to get going.

The reason I need the routine is to burn a folder to a cd.  I now  
have that working on mac using applescript and shell commands - but  
before long I will have to have a go at windows (gulp!) so this code  
will save me hours!

Thanks,

Chris



On 13 Jul 2005, at 09:44, Eric Chatonet wrote:

> Hello Chris,
>
> Here is a piece of code (from Frederic Rinaldi I think) which can  
> get you started:
> Params:
> theFolder: path to the root folder you want to scan
> addFullPath : boolean to get absolute (true) or relative path (false)
> allInfos : boolean to get all information (true) or path only (false)
>
> item 2 & 3 in the returned list with allInfos=true are the file  
> size (data fork with Mac OS) and the resource fork size (Mac OS  
> only, 0 for others)
>
> function AllFiles theFolder,addFullPath,allInfos
>   --returns full path of all enclosed files
>   local startFolder
>   set cursor to busy
>   if last char of theFolder is not "/"
>   then put "/" after theFolder
>   if startFolder is empty
>   then put theFolder into startFolder
>
>   set the defaultFolder to theFolder
>   if the result is not empty
>   then
>     beep
>     answer error "Répertoire inexistant:" & return & return &  
> theFolder titled "Erreur"
>     exit to top
>   end if
>
>   put the detailed files into filesList
>   filter filesList without ".*"
>   filter filesList without "Icon%0D*"
>   filter filesList without "*,MACSfdrp" -- remove folder aliases
>
>   put the folders into foldersList
>   filter foldersList without ".*"
>
>   repeat for each line loopFolder in foldersList
>     put AllFiles(thefolder & loopFolder & "/",addFullPath,allInfos)  
> & return after resultList
>   end repeat
>
>   repeat with i=number of lines of filesList down to 1
>     -- set cursor to busy
>     if addFullPath
>     then put MyURLEncode(theFolder) before line i of filesList
>     if allInfos = false
>     then put item 1 of line i of filesList into line i of filesList
>   end repeat
>
>   get resultList & filesList
>   sort lines of it
>   return word 1 to -1 of it -- strip empty lines
> end AllFiles
> ------------------
> function MyURLEncode what
>   put URLEncode(what) into what
>   replace "%2F" with "/" in what
>   return what
> end MyURLEncode
>
> Le 13 juil. 05 à 10:15, Chris Carroll-Davis a écrit :
>
>
>> Iit's for both Mac & PC really - but mainly mac at the moment.  
>> Since posting, I've found that I can get the info I need with  
>> applescript - "Tell application "Finder" ... return physical size  
>> of folder "Folderpath"  ... End tell", but of course that's no  
>> good for PC.  I could look at your suggestion, but I need this to  
>> run on any machine - i.e. I can't rely on any other software being  
>> installed.   :-(
>>
>> Looks like I might have to bite the bullet and do it with  
>> transcript eventually. Yuk.  I know for a decent programmer it is  
>> an easy job, but I'm getting old and brain is slow!
>>
>> Thanks
>>
>> Chris
>>
>>>
>>>
>>>> Hello folks -
>>>>
>>>> Anyone know if there is an easy way in Rev of getting the size of a
>>>> folder (together with all it's sub-folders).  I know I can do a  
>>>> loop
>>>> using "detailed files" and "detailed folders" but that seems a bit
>>>> long-winded, and I'm sure I'd be re-inventing the wheel!  Is there
>>>> another way, or is there an existing function anywhere that I  
>>>> can pinch?
>>>>
>
>
> Best Regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Free plugins and tutorials on my website
> ----------------------------------------------------------------
> Web site        http://www.sosmartsoftware.com/
> Email        [hidden email]/
> Phone        33 (0)1 43 31 77 62
> Mobile        33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution