Results 1 to 5 of 5

Thread: How do I copy a directory to drive A?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    MN, USA
    Posts
    25

    Exclamation

    Hello,
    I tried to copy a certain directory using:
    FileCopy "C:\bla bla", "A:\"
    It returns a message saying:
    "Path/File Access Error"
    Can anyone help?

    Thank you

  2. #2
    Guest
    Here's an example. Make a Form with 2 CommandButtons.

    Put this code in Command1

    Code:
    Private Sub Command1_CLick()
    
       Open "C:\test.txt" For Output As #1
       Print #1, "abcdefghijklmnopqrstuvwxyz"
       Close #1
    
    End Sub
    Put this code in Command2.

    Code:
    Private Sub Command2_Click()
    
       SFile = "C:\ttt.txt"
       DFile = "A:\"
    
       FileCopy SFile, DFile
    
    End Sub



  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You cannot copy a folder automatically. To do it manually

    Make the main sub using mkdir
    Loop trough all items in you subdir by using dir or fso object and copy the files independently.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    MN, USA
    Posts
    25
    Thanks, but how do you make the loop to send the files in the folder to "A:"?

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    HAven't tested it, i just wrote it down here
    Code:
    Dim a$
    A=dir(yourdir)
    do while len(a)
     filecopy a, "a:\" & a
     a=dir
    loop
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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



Click Here to Expand Forum to Full Width