Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Where is the Copy method? (VB2008 Express Ed.)

    Subject edited by HansV to correct typos

    I am creating a backup file archiving system in which I have to copy files and directories of files (and directories of directories of files, etc.). To copy files, I use the File class's Copy method. To copy directories of files I--but there's the problem: It seems that there is no Copy method in the Directory class. There is a Move method, but I don't want to disturb the original. Two questions: 1. Why is there no Copy method in the Directory class? 2. Is there a reasonable workaround to this limitation?

    Thank you,

    John Littell

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Where is the Copy method? (VB2008 Express Ed.)

    I can't answer this on the basis of knowledge, but it sounds as though you were meant to get the files in the directory and copy them individually.

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Where is the Copy method? (VB2008 Express Ed.)

    That does sound reasonable. But with the directory structure of Vista's internal Backup and Restore Center application, that would be a huge undertaking as every single directory would have to be identified, created and populated one at a time. Even so, why on earth would the Directory class provide a Move method (more dangerous that Copy), and not a Copy method?

    John

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Where is the Copy method? (VB2008 Express Ed.)

    Can you use:
    <code>My.Computer.FileSystem.CopyDirectory(sourceD irectoryName ,destinationDirectoryName)</code>
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •