MACSCRPT Archives

May 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Andreas Kiel <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 30 May 2007 01:00:07 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (56 lines)
Thanks John,

That was(is) not the problem - unfortunately.

The problem is to get the file size of a file which is still growing  
to do the next step with file after the file is complete written to  
disk.
All ways of doing that fail if the file name is longer than 31  
characters, all of them work if not.
That's a little odd I think.

Regards
Andreas

On 30.05.2007, at 00:12, John Delacour wrote:

> At 7:21 pm +0200 29/5/07, Andreas Kiel wrote:
>
>> Hi all,
>>
>> I already asked at the ASS list, but it might be better to ask here.
>>
>> I'm a little bit desperate about getting the file size of a busy  
>> file when the file name has more than 31 characters.
>> It always works if the file is written, but not when the file is  
>> busy and that's what I need.
>> I tried a shell script, get eof, size of (info). Always same  
>> behaviour.
>>
>> Anybody any idea why - or how to solve?
>> Sure I could use a temporary name and then re-name the files, but  
>> maybe there is something more elegant.
>
> Perhaps I am misunderstanding the problem, but this script seems to  
> do what you want without a snag:
>
>
>         set _filename to "abcdefghijklmnopqrstuvwxyzabcdefghi.txt"
>         set _folder to "/tmp/"
>         set f to _folder & _filename as POSIX file
>         try
>           close access f
>         end try
>         set _sizelist to {}
>         open for access f with write permission
>         set eof f to 0
>         repeat 10 times
>           write "abc" to f
>           set end of _sizelist to (get eof f) as integer
>         end repeat
>         close access f
>         return _sizelist
>         --=> {3, 6, 9, 12, 15, 18, 21, 24, 27, 30}
>
> JD

ATOM RSS1 RSS2