gettingstarted
[Top] [All Lists]

Re: CopyFileTo

To: "Getting Started" <gettingstarted at lists dot realsoftware dot com>
Subject: Re: CopyFileTo
From: "Aaron Ballman" <aaron at realsoftware dot com>
Date: Sun, 30 May 2004 09:40:35 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
List-help: <mailto:gettingstarted-request@lists.realsoftware.com?subject=help>
List-id: Getting Started <gettingstarted.lists.realsoftware.com>
List-post: <mailto:gettingstarted@lists.realsoftware.com>
References: <5BCED05C-B23D-11D8-B825-0003933D673A at kellerfarm dot com>
> Whenever I try to use the CopyFileTo method, this takes over
> everything, even in a thread.  Is there a way to make this run in the
> background?

You can create your own Copy method that runs in a thread.  Just use a
BinaryStream to copy the file over.  Something like this:

Dim fromFile, toFile as FolderItem
Dim fromStream, toStream as BinaryStream

' Get fromFile and toFile
...

' Open the streams up
fromStream = fromFile.OpenAsBinaryFile( false )
toStream = toFile.CreateBinaryFile( "" )

' Copy the data from one stream to the other
while not fromStream.EOF
  toStream.Write( fromStream.Read( 1024 ) )
wend

' Close the stream
fromStream.Close
toStream.Close

Note that there's no error checking -- you'll want to add that.  But this
will copy the files over in the background if you put it in a thread.

HTH!

~Aaron

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

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

<Prev in Thread] Current Thread [Next in Thread>