file size

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

file size

larry
Hello,

I know I can use:
put the files into field "Current Files"

to get the size of a file (in bytes), but is there any way to use "answer file" or some other way to get the size of just one specific file?



Thanks,

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

Re: file size

Paul Hibbert
Larry,

Try:

on mouseUp
   answer file "?"
   put "binfile:" & it into tFile
   put the length of URL tFile / 1000 & "KB" into fld "myResultField"
end mouseUp

Paul

On Sep 22, 2014, at 2:29 PM, [hidden email] wrote:

> Hello,
>
> I know I can use:
> put the files into field "Current Files"
>
> to get the size of a file (in bytes), but is there any way to use "answer file" or some other way to get the size of just one specific file?
>
>
>
> Thanks,
>
> Larry
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


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

Re: file size

Alex Tweedly
In reply to this post by larry
On 22/09/2014 22:29, [hidden email] wrote:
> Hello,
>
> I know I can use:
> put the files into field "Current Files"
>
> to get the size of a file (in bytes), but is there any way to use "answer file" or some other way to get the size of just one specific file?
>
>
You could always do  (typing into email, untested ...)
    put shell("ls -l " & theFileInQuestion) into temp
and then parse temp to get the size out.
If the filename could contain special characters (e.g. spaces) then you
would need to add some extra level of quotes.

So it would be easier (and almost certainly faster) to do
    put the detailed files into temp
    filter temp with "*" & theFileInQuestion & "*")
and then parse that.

-- Alex.

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

Re: file size

Richard Gaskin
In reply to this post by larry
Larry wrote:

> ... is there any way to use "answer file" or some other way to get
> the size of just one specific file?

on mouseUp
    answer file "Select a file:"
    if it is empty then exit to top
    put FileSize(it)
end mouseUp

function FileSize pFilePath
    put the directory into tSaveDir
    set the itemdel to "/"
    put urlEncode(last item of pFilePath) into tFileName
    delete last item of pFilePath
    set the directory to pFilePath
    put the detailed files into tFiles
    set the directory to tSaveDir
    put lineoffset( cr& tFileName &comma, cr& tFiles) into tLineNum
    set the itemdel to comma
    return item 2 of line tLineNum of tFiles
end FileSize


But it really should be a one-liner, so I submitted a request for being
able to obtain such info for a single file:
<http://quality.runrev.com/show_bug.cgi?id=13182>

--
  Richard Gaskin
  Fourth World Systems
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter: http://twitter.com/FourthWorldSys

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

iOS 8 orientation

Ralph DiMola
Orientation changes seem have stopped working on iOS 8 iPad/LC6.6.3/Xcode
5.1.1.

The initial orientation is correctly reported but no changes are allowed.
I unlocked orientation change and allowed the appropriate orientations.

Anyone else seen this?

Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]



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

Re: file size

larry
In reply to this post by Paul Hibbert
Thanks Paul and Alex and Richard,

I ended up using Paul's code:
on mouseUp
   answer file "?"
   put "binfile:" & it into tFile
   put the length of URL tFile / 1000 & "KB" into fld "myResultField"
end mouseUp

It works just great!
Larry

----- Original Message -----
From: "Paul Hibbert" <[hidden email]>
To: "How to use LiveCode" <[hidden email]>
Sent: Monday, September 22, 2014 4:50 PM
Subject: Re: file size


> Larry,
>
> Try:
>
> on mouseUp
>   answer file "?"
>   put "binfile:" & it into tFile
>   put the length of URL tFile / 1000 & "KB" into fld "myResultField"
> end mouseUp
>
> Paul
>
> On Sep 22, 2014, at 2:29 PM, [hidden email] wrote:
>
>> Hello,
>>
>> I know I can use:
>> put the files into field "Current Files"
>>
>> to get the size of a file (in bytes), but is there any way to use "answer
>> file" or some other way to get the size of just one specific file?
>>
>>
>>
>> Thanks,
>>
>> Larry
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 


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

Re: file size

Michael Doub
‎To be technically correct divide by 1024.  

Mike

  Original Message  
From: [hidden email]
Sent: Monday, September 22, 2014 8:21 PM
To: How to use LiveCode
Reply To: How to use LiveCode
Subject: Re: file size

Thanks Paul and Alex and Richard,

I ended up using Paul's code:
on mouseUp
answer file "?"
put "binfile:" & it into tFile
put the length of URL tFile / 1000 & "KB" into fld "myResultField"
end mouseUp

It works just great!
Larry

----- Original Message -----
From: "Paul Hibbert" <[hidden email]>
To: "How to use LiveCode" <[hidden email]>
Sent: Monday, September 22, 2014 4:50 PM
Subject: Re: file size


> Larry,
>
> Try:
>
> on mouseUp
> answer file "?"
> put "binfile:" & it into tFile
> put the length of URL tFile / 1000 & "KB" into fld "myResultField"
> end mouseUp
>
> Paul
>
> On Sep 22, 2014, at 2:29 PM, [hidden email] wrote:
>
>> Hello,
>>
>> I know I can use:
>> put the files into field "Current Files"
>>
>> to get the size of a file (in bytes), but is there any way to use "answer
>> file" or some other way to get the size of just one specific file?
>>
>>
>>
>> Thanks,
>>
>> Larry
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 


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

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

Re: file size

larry
Hi Mike,
good point, but actually my line is:
put the length of URL tFile into field "myResult"

because I want the actual number and not how many kb.
Larry

----- Original Message -----
From: <[hidden email]>
To: <[hidden email]>; "How to use LiveCode"
<[hidden email]>
Sent: Monday, September 22, 2014 6:28 PM
Subject: Re: file size


> ‎To be technically correct divide by 1024.
>
> Mike
>
> Original Message
> From: [hidden email]
> Sent: Monday, September 22, 2014 8:21 PM
> To: How to use LiveCode
> Reply To: How to use LiveCode
> Subject: Re: file size
>
> Thanks Paul and Alex and Richard,
>
> I ended up using Paul's code:
> on mouseUp
> answer file "?"
> put "binfile:" & it into tFile
> put the length of URL tFile / 1000 & "KB" into fld "myResultField"
> end mouseUp
>
> It works just great!
> Larry
>
> ----- Original Message -----
> From: "Paul Hibbert" <[hidden email]>
> To: "How to use LiveCode" <[hidden email]>
> Sent: Monday, September 22, 2014 4:50 PM
> Subject: Re: file size
>
>
>> Larry,
>>
>> Try:
>>
>> on mouseUp
>> answer file "?"
>> put "binfile:" & it into tFile
>> put the length of URL tFile / 1000 & "KB" into fld "myResultField"
>> end mouseUp
>>
>> Paul
>>
>> On Sep 22, 2014, at 2:29 PM, [hidden email] wrote:
>>
>>> Hello,
>>>
>>> I know I can use:
>>> put the files into field "Current Files"
>>>
>>> to get the size of a file (in bytes), but is there any way to use
>>> "answer
>>> file" or some other way to get the size of just one specific file?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Larry
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 


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

Re: iOS 8 orientation

Mike Kerner
In reply to this post by Ralph DiMola
Yes, and I think there's a bug report for this, but don't quote me on that.

On Mon, Sep 22, 2014 at 8:15 PM, Ralph DiMola <[hidden email]>
wrote:

> Orientation changes seem have stopped working on iOS 8 iPad/LC6.6.3/Xcode
> 5.1.1.
>
> The initial orientation is correctly reported but no changes are allowed.
> I unlocked orientation change and allowed the appropriate orientations.
>
> Anyone else seen this?
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> [hidden email]
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: file size

Phil Davis-5
In reply to this post by larry
If you want to do it entirely in LC and not use a shell command, you
could do this:

on mouseUp
     answer file "Pick a file:"
     if it is empty then exit to top
     set the itemDelimiter to slash
     put the defaultFolder into tOriginalDefault
     set the defaultFolder to item 1 to -2 of it
     put the detailed files into tList
     set the defaultFolder to tOriginalDefault
     filter tList with urlEncode(last item of it) & ",*"
     set the itemDelimiter to comma
     answer "Length of file" && quote & first item of tList & quote &&
"is" && item 2 of tList && "bytes."
end mouseUp

Phil Davis



On 9/22/14 2:29 PM, [hidden email] wrote:

> Hello,
>
> I know I can use:
> put the files into field "Current Files"
>
> to get the size of a file (in bytes), but is there any way to use "answer file" or some other way to get the size of just one specific file?
>
>
>
> Thanks,
>
> Larry
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

--
Phil Davis


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

Re: file size

Paul Hibbert
In reply to this post by Michael Doub
Mike,

That's just what I thought, but it doesn't agree with the actual file size shown in the finder, dividing by 1000 does agree with the finder.

It appears this depends on whether the system uses Binary or Decimal calculations, it seems Apple use Decimal.

Paul

On Sep 22, 2014, at 5:28 PM, [hidden email] wrote:

> ‎To be technically correct divide by 1024.  
>
> Mike
>
>   Original Message  
> From: [hidden email]
> Sent: Monday, September 22, 2014 8:21 PM
> To: How to use LiveCode
> Reply To: How to use LiveCode
> Subject: Re: file size
>
> Thanks Paul and Alex and Richard,
>
> I ended up using Paul's code:
> on mouseUp
> answer file "?"
> put "binfile:" & it into tFile
> put the length of URL tFile / 1000 & "KB" into fld "myResultField"
> end mouseUp
>
> It works just great!
> Larry
>
> ----- Original Message -----
> From: "Paul Hibbert" <[hidden email]>
> To: "How to use LiveCode" <[hidden email]>
> Sent: Monday, September 22, 2014 4:50 PM
> Subject: Re: file size
>
>
>> Larry,
>>
>> Try:
>>
>> on mouseUp
>> answer file "?"
>> put "binfile:" & it into tFile
>> put the length of URL tFile / 1000 & "KB" into fld "myResultField"
>> end mouseUp
>>
>> Paul
>>
>> On Sep 22, 2014, at 2:29 PM, [hidden email] wrote:
>>
>>> Hello,
>>>
>>> I know I can use:
>>> put the files into field "Current Files"
>>>
>>> to get the size of a file (in bytes), but is there any way to use "answer
>>> file" or some other way to get the size of just one specific file?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Larry
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode 
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


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

Re: iOS 8 orientation

hlowe
This post has NOT been accepted by the mailing list yet.
In reply to this post by Mike Kerner
Yes, it has been reported (and confirmed) as a bug.

http://quality.runrev.com/show_bug.cgi?id=13494

Henry Lowe
Reply | Threaded
Open this post in threaded view
|

Re: file size

Dick Kriesel
In reply to this post by Richard Gaskin
On Sep 22, 2014, at 4:33 PM, Richard Gaskin <[hidden email]> wrote:

> But it really should be a one-liner

OK, Richard.  Here's one.

-- given variable tFile, containing the name of a file in the default folder
-- given variable tSize, which is where to put the size of the file

     get matchText( the detailed files, ( "(?m)^\Q" & urlEncode( tFile ) & ",\E(\d*).*" ), tSize )

Too bad it's so hard to read, remember, and type.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: file size

Thierry Douez
2014-09-23 9:47 GMT+02:00
Dick Kriesel <[hidden email]>:

>> But it really should be a one-liner
>
> -- given variable tFile, containing the name of a file in the default folder
> -- given variable tSize, which is where to put the size of the file
>
>      get matchText( the detailed files, ( "(?m)^\Q" & urlEncode( tFile ) & ",\E(\d*).*" ), tSize )

Excellent! I like it :)

> Too bad it's so hard to read, remember, and type.

Dick,

Here is a modified version of yours:

matchText(the detailed files,("(?m)^" & urlEncode( tFile ) & ",(\d+)" ), tSize)


and  I really don't find hard at all to read...


Regards,

Thierry


------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

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

Re: file size

JB
Can you get the creation date, modified date and type etc. without
using the detailed files?  And if so would it be faster than using the
detailed files?

I know you could get it by using NSFIlemanager.  If you want the
type the detailed files is not reliable.

John Balgenorth


On Sep 23, 2014, at 1:13 AM, Thierry Douez <[hidden email]> wrote:

> 2014-09-23 9:47 GMT+02:00
> Dick Kriesel <[hidden email]>:
>
>>> But it really should be a one-liner
>>
>> -- given variable tFile, containing the name of a file in the default folder
>> -- given variable tSize, which is where to put the size of the file
>>
>>     get matchText( the detailed files, ( "(?m)^\Q" & urlEncode( tFile ) & ",\E(\d*).*" ), tSize )
>
> Excellent! I like it :)
>
>> Too bad it's so hard to read, remember, and type.
>
> Dick,
>
> Here is a modified version of yours:
>
> matchText(the detailed files,("(?m)^" & urlEncode( tFile ) & ",(\d+)" ), tSize)
>
>
> and  I really don't find hard at all to read...
>
>
> Regards,
>
> Thierry
>
>
> ------------------------------------------------
> Thierry Douez - http://sunny-tdz.com
> Maker of sunnYperl - sunnYmidi - sunnYmage
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


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

Re: file size

Dick Kriesel
In reply to this post by Thierry Douez
On Sep 23, 2014, at 1:13 AM, Thierry Douez <[hidden email]> wrote:

> Here is a modified version of yours:
>
> matchText(the detailed files,("(?m)^" & urlEncode( tFile ) & ",(\d+)" ), tSize)


Hi, Thierry.

When the file name contains a space, urlEncode encodes the space as +, which regex interprets, causing the match to fail and tSize to be empty.  The \Q...\E causes regex to see everything enclosed as a literal, including the +, so the match succeeds and tSize is correct.

Glad you like it.

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

Re: file size

Thierry Douez
Dick, thanks for the feedback.

I forgot about this:

> ... urlEncode encodes the space as +, ...



Regards,

Thierry



------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

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