On 8/18/2006 12:52 PM, [EMAIL PROTECTED] wrote:
> On Aug 18, 2006, at 16:43 UTC, Charles Calvert wrote:
> 
>> Assuming that the overhead of multiple executing shell commands is too
>> much, should I continue to pursue using API functions as my best bet?
> 
> You can execute a single shell with the command "sh" (or "tcsh" or
> "bash" or whatever shell you prefer), then give it multiple copy
> commands with Shell.Write.

Thanks.

> If it's still too slow, I think you're out of luck -- keep in mind that
> both the shell commands (cp and ditto) and RB's own file-copying
> commands are already using API functions, and not purposely wasting
> time about it.  It's unlikely you could do any better with declares,
> unless there is some shortcut available due to the unique constraints
> of your app.

That's what I would have thought, then I ran some tests.  I wrote a very
simple app to copy a folder hierarchy from one place to another.  It
calls the Ticks function at the beginning and end to track the time.
The copying function is a simple recursive one:

Sub CopyItem(item As FolderItem, dest As FolderItem)
    Dim i As Integer
    Dim child As FolderItem

    Try
        If item.Directory Then
            child = dest.Child(item.Name)
            child.CreateAsFolder()
            For i = 1 To item.Count
                CopyItem(item.Item(i), child)
            Next i
        Else
            item.CopyFileTo(dest)
        End If

    Catch ex As RuntimeException
        MsgBox "Unable to copy item: '" + _
            m_folderSource.Item(i).AbsolutePath + "'.  Error: " + _
                ex.Message
    End Try
End Sub

When running on a Mac Mini with a 1.4 GHz G4 and 1 GB of RAM, the
program took 38 minutes to copy a 17 GB hierarchy.  Finder took only 28
minutes to perform the same task.  That's a pretty big difference.

-- 
Charles Calvert
Celtic Wolf, Inc.
(703) 580-0210
[EMAIL PROTECTED]
http://www.celticwolf.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to