Simple copy program

Hi, I'm new to VB (obviously) and I'm trying to create a program that will copy the contents of a CD (to distribute on that CD) to a hard drive. I have tried using a batch program with the "xcopy" command, but Windows XP just doesn't work with a DOS shell too well. Is there a way I can do this with VB Or possibly even Javascript

Answer this question

Simple copy program

  • Breckish

    Thanks for the help, everyone! I finally got the VB program to work, but thanks to everyone who helped me with that batch file.
  • lokeshbohra

    What is not working with that batch How do you ensure that the current directory which you reference with . is set to the CD or DVD directory you want to copy

    Does C:\CDcontents exist Otherwise you must create it with md.

    --
    SvenC


  • Sujeet Kuchibhotla

    You might want to take a look at VB's "My" namespace: it has lots of interesting features, such as the filesystem functions which you look. A quick example which should get you started:

    '// Define the source and target paths (hardcoded just for the idea).
    Dim SourcePath As String = "D:\"
    Dim TargetPath As String = "C:\Temp"

    '// Use VB's "MY" namespace for an easy shortcut.
    '// Ofcourse you can give additional parameters for copying directories
    '// and files, but this should get you started.
    My.Computer.FileSystem.CopyDirectory(SourcePath, TargetPath)


  • seco

    Here's my xcopy program:

    xcopy /s .\ C:\CDcontents
    echo Files copied to "CDcontents" in "C" drive.
    break

    I'll try the VB program and let you know if it works.


  • DJacobson

    Hi,

    what is your xcopy problem That should work.

    --
    SvenC


  • kp6452

    So you are always copying to C:\ - if you distribute that to a wider range you can get into trouble as not all people want stuff on C:\ or maybe their C:\ is almost full and D:\ or some other partition would be more apropriate.

    Just a guess.

    --
    SvenC


  • CraigInCalifornia

    I'm sure it's the right directory because I'm putting the batch program on the CD. But, no, I hadn't thought about md. I'll pop that in and change the syntax and then see what happens.
  • Redburga

    the problem there is that you have .\ which you shouldnt. As well as this, the usage is wrong. it should be:

    xcopy C:\CDContents DestinationPathHere /s

    usage:

    xcopy source [destination] [switches]



  • Simple copy program