Home All Groups Group Topic Archive Search About

How To Force Copy One File To Another

Author
25 May 2006 12:46 PM
Christopher Lusardi
If I want to copy one file to another how do I do that? I want to do
this even if the second file already exists.

Thanks,
Christopher Lusardi

Author
25 May 2006 1:07 PM
Robin Mark Tucker
Try

    File.Copy ( "C:\ahhh\ohhh\eeeee\bbboooo\myfile.poo",
"C:\ahhh\ohhh\eeeee\aaaaeeee\myfile.poo", True )

Finally

End Try

Show quoteHide quote
"Christopher Lusardi" <clusard***@aol.com> wrote in message
news:1148561217.588575.149470@i40g2000cwc.googlegroups.com...
> If I want to copy one file to another how do I do that? I want to do
> this even if the second file already exists.
>
> Thanks,
> Christopher Lusardi
>
Author
25 May 2006 1:10 PM
sfbell09
To force copy in VB, I use:
fso.FileCopy src dest true

Where:
fso - file system object I created earlier
..FileCopy - the command to copy a file
src - variable w/ the source file full path/name
dest - variable w/ the destination file full path and name
true - Boolean to determine overwrite status.

One problem this could run into is permissions, another is if one of
the files is in use by another process.
Author
25 May 2006 1:26 PM
Chris Dunaway
Except that this is Vb.Net and the FileSystemObject is obsolete.  Just
use the classes in the System.IO namespae as Robin suggested.