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

    Home » Forums » Developers, developers, developers » DevOps Lounge » Where is the Copy method? (VB2008 Express Ed.)

    Author
    Topic
    #448099

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1094731

      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.

      • #1094752

        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

        • #1094856

          Can you use:
          My.Computer.FileSystem.CopyDirectory(sourceDirectoryName ,destinationDirectoryName)

    Viewing 0 reply threads
    Reply To: Where is the Copy method? (VB2008 Express Ed.)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: