Results 1 to 3 of 3

Thread: VB6 - copying multiple files at once

  1. #1
    Join Date
    Mar 2002

    VB6 - copying multiple files at once

    Hello All,

    I've been playing with VB6 a little and was wondering how someone could code this.

    I'm trying to copy several files with the same extention (ex: *.txt) from several folders to one.

    the command FileCopy only allows for one file at a time (that I know of)
    I tried using the shell "xcopy" command but only get the files from the directory that the VB program runs from.

    I wrote:

    private sub command1_click()
    shell "xcopy *.txt /s c:\backup"
    end sub

    but I don't get the same result as when I'm in DOS.

    Any suggestions, or corrections?

  2. #2
    Ninja Code Monkey
    Join Date
    Nov 2001
    Washington State
    You probably need to set your current working directory to the appropriate directory for the xcopy.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  3. #3
    Senior Member
    Join Date
    Apr 2004

    Re: VB6 - copying multiple files at once

    private sub command1_click()
         shell "xcopy c:\*.txt /s c:\backup"
    end sub
    will work?
    Its not vb6 problem; is a working directory problem (as Juridian stated). If you dont specify source path, windows will assume current (or working directory).
    Meu sítio

    FORMAT C: Yes ...Yes??? ...Nooooo!!! ^C ^C ^C ^C ^C
    If I die before I sleep, I pray the Lord my soul to encrypt.
    If I die before I wake, I pray the Lord my soul to brake.

Posting Permissions

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