How To Force Copy One File To Another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher Lusardi

    #1

    How To Force Copy One File To Another

    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

  • Robin Mark Tucker

    #2
    Re: How To Force Copy One File To Another


    Try

    File.Copy ( "C:\ahhh\ohhh\e eeee\bbboooo\my file.poo",
    "C:\ahhh\ohhh\e eeee\aaaaeeee\m yfile.poo", True )

    Finally

    End Try

    "Christophe r Lusardi" <clusardi2k@aol .com> wrote in message
    news:1148561217 .588575.149470@ i40g2000cwc.goo glegroups.com.. .[color=blue]
    > 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
    >[/color]


    Comment

    • sfbell09@gmail.com

      #3
      Re: How To Force Copy One File To Another

      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.

      Comment

      • Chris Dunaway

        #4
        Re: How To Force Copy One File To Another

        Except that this is Vb.Net and the FileSystemObjec t is obsolete. Just
        use the classes in the System.IO namespae as Robin suggested.

        Comment

        Working...