Copying a whole thumb drive in VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skygremlin
    New Member
    • Jul 2008
    • 2

    #1

    Copying a whole thumb drive in VB

    I am trying to write a simple VB app to copy all directories and files off a thumb drive to a directory on a pc. I have a couple things I am trying to automate.

    Final Build will:
    - Have multiple USB connections for multiple drives to copy from at the same time
    - Have seperate directories for each individual who will copy to the pc
    - Have a list box where I would like to choose which directory (Individual) to copy files to, and a seperate list box to choose which thumb drive to copy from
    - Auto name each directory with a prefix and current time


    Below is what I've been playing with.
    - I can select an individual from my list box
    - I Can copy a directory and subs over to D:\Video
    - Decide what to call it with the current time.

    BUT I cannot copy over a whole drive. for example - if H is my thumb drive please see below.

    Works:
    - this will create a folder under D:\video
    - name that folder by whatever is selected in the list box, and the current time
    - Then copy over everything from H:\pix to D:\Video\<new folder>

    My.Computer.Fil eSystem.CreateD irectory("D:\Vi deo\" & lstvidguy.Selec tedItem & time)
    My.Computer.Fil eSystem.CopyDir ectory("H:\pix" , "D:\Video\" & lstvidguy.Selec tedItem & time, True)


    Not work - BUT what I need:
    - this will create a folder under D:\video
    - name that folder by whatever is selected in the list box, and the current time
    - Then copy over everything from H:\ to D:\Video\<new folder>

    My.Computer.Fil eSystem.CreateD irectory("D:\Vi deo\" & lstvidguy.Selec tedItem & time)
    My.Computer.Fil eSystem.CopyDir ectory("H:\", "D:\Video\" & lstvidguy.Selec tedItem & time, True)

    What I need help with is:
    1) What little code am I missing to copy over the whole drive?

    Please keep in mind I have 1 semester of beginning VB under my belt..:)
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    I always use FileInfo and DirectoryInfo objects for file transfers. You should check them out.

    Comment

    Working...