Monitor Shell Copy File Progress

Phil Davis revdev at pdslabs.net
Sat May 22 22:34:33 EDT 2010


I bet you could use cURL for this, using the FILE protocol. Build your 
curl command line with filenames formatted for curl; open it as a 
process for read; read that process's output every 500 msecs or so to 
get the progress info.

I'm on assignment in NZ right now so I don't have everything at my 
fingertips. Josh Mellicker made me aware of curl a few months ago, and 
Ken Ray may have made a rev library of it by now.  ;-)  Also Mark Smith 
created a rev curl lib some time ago.

Food for thought...

Phil Davis



On 23/05/10 12:26 PM, Alex Tweedly wrote:
> First thought : I thought (according to Dictionary) that "shell" would 
> wait until the command was complete before returning - dictionary says
>> The current handler pauses until the shell returns its result. If the 
>> command was successful but did not return anything, the shell 
>> function returns empty.
> Second try :   why take a checksum, why not just use the file size ?  
> Getting the checksum may involve copying the file from the remote 
> server into your laptop to calculate the checksum.
>
> Third try : instead of doing "shell 'cp file ....' "  could you do
>    load url ("file:" & tRemotepathname)
>    ....   check the cachedURLs ....
>    put url("file:" & tRemotepathname) into url('file:" & tLocalfilename)
>
> -- Alex.
>
> On 22/05/2010 23:35, Sivakatirswami wrote:
>> Work working on an in-house file manager - RCS for Indesign (since 
>> Adobe did an "end of life" for Version Cue)
>>
>> It's coming along well, in fact really well.
>>
>> One challenge is that I'm using  lots of these:
>>
>>   put ("mv " & quote & gLocalFilePath & quote &" "& quote & 
>> (gLocalProjectPath& "/"& tShortFileName) & quote) into tShell
>>    get shell (tShell)
>>
>>    put ("cp " & quote & (gLocalProjectPath& "/"& tShortFileName) & 
>> quote &" "& quote & (gServerProjectPath& "/"& tShortFileName) & 
>> quote) into tShell
>>    get shell (tShell)
>>
>> to more files around and rename them... it works great.
>>
>> Is there a way to monitor a background shell process like this?
>>
>> The problem is if you copy from the Big Server on the LAN... to my 
>> Little MacBook Pro... you won't know when the file is completely 
>> copied to the local hard drive before doing:
>>
>>      launch (gLocalProjectPath &"/" & pFileName) with the 
>> uInDesignPath of this stack
>>
>> Typically RunRev will issue the unix cp command and then immediately 
>> launch inDesign, which "crokes" because the file is incomplete on the 
>> local hard drive.
>>
>> Now I have some ideas about how to do this: get the checksum some of 
>> the remote file, do a send in 30 ticks (repeatedly) test of the local 
>> file until the local file's checksum matches the remote file and then 
>> launch it.
>>
>> But before I go after this, I was wondering if anyone had any other 
>> method?  Most "cool" would be a progress bar, but I'm not sure RunRev 
>> can monitor a local unix copy file process....or, if it can, how to 
>> do it.
>>
>> Thanks!
>> Sivakatirswami




More information about the Use-livecode mailing list