copying file to sub dir 
Author Message
 copying file to sub dir

hi all

i am trying to write an update to a prog i made a while ago and i have no
trouble copying to the main dir i want but i need to copy to a sub dir and i
can not get it to work.

in the folder with the new files i made the sub dir DLL
is in c:\update\dll

i can copy to c:\dest from c:\update but having trouble copying from
c:\update\dll to c:\dest\dll

Private Sub Command1_Click()
   Dim sSourcePath As String
   Dim sDestination As String
   Dim sFiles As String
   Dim numCopied As Long
   Dim icqdest As String

Command2.Enabled = True

   sSourcePath = "c:\update\"

   progdest = txtdest.Text     'this is where the user types in the location
of the prog

   sDestination = progdest

   sFiles = "*.*"                    'copies all file types

' removes all of the old files

Kill icqdest & "\file1.zzz"

Kill icqdest & "\file2.zzz"

Kill icqdest & "\file3.zzz "

Kill icqdest & "\file4.zzz"

Kill icqdest & "\dll\file5.dll"

'Here is where i have the trouble how do i tell it to copy sub dir's as
well?

numCopied = rgbCopyFiles(sSourcePath, sDestination, sFiles)

   MsgBox numCopied & " files copied to " & sDestination

   MsgBox "Old files have been removed and new files have been copied", 0,
"Notice"

Thanx for any help
steve



Wed, 27 Aug 2003 15:36:26 GMT  
 copying file to sub dir
Some are going to wonder what rgbCopyFiles() is (my initials).

What you need to do is add some debug.print statements to the code to print
out _exactly_ what the sSource, sDestination and sFiles variable holds on
entering the rgbCopyFiles routine. Off-hand, are you sure the variables end
up in the format

  x=c:\update\dll\*.*

and not

  x=c:\update\dll*.*

--

Randy Birch
MVP Visual Basic

Take the vb.net poll at:
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Please respond only to the newsgroups so all can benefit.


: hi all
:
: i am trying to write an update to a prog i made a while ago and i have no
: trouble copying to the main dir i want but i need to copy to a sub dir and
i
: can not get it to work.
:
: in the folder with the new files i made the sub dir DLL
: is in c:\update\dll
:
: i can copy to c:\dest from c:\update but having trouble copying from
: c:\update\dll to c:\dest\dll
:
:
: Private Sub Command1_Click()
:    Dim sSourcePath As String
:    Dim sDestination As String
:    Dim sFiles As String
:    Dim numCopied As Long
:    Dim icqdest As String
:
:
: Command2.Enabled = True
:
:    sSourcePath = "c:\update\"
:
:    progdest = txtdest.Text     'this is where the user types in the
location
: of the prog
:
:    sDestination = progdest
:
:    sFiles = "*.*"                    'copies all file types
:
: ' removes all of the old files
:
: Kill icqdest & "\file1.zzz"
:
: Kill icqdest & "\file2.zzz"
:
: Kill icqdest & "\file3.zzz "
:
: Kill icqdest & "\file4.zzz"
:
: Kill icqdest & "\dll\file5.dll"
:
: 'Here is where i have the trouble how do i tell it to copy sub dir's as
: well?
:
: numCopied = rgbCopyFiles(sSourcePath, sDestination, sFiles)
:
:    MsgBox numCopied & " files copied to " & sDestination
:
:    MsgBox "Old files have been removed and new files have been copied", 0,
: "Notice"
:
: Thanx for any help
: steve
:
:
:



Wed, 27 Aug 2003 23:43:35 GMT  
 copying file to sub dir
yeah i got that part (rgb stuff) from the net a while ago and decided to
have a play with it.

in the txtdest a \ must be typed at the end or else the dll*.* thing happens
( i make note of that in the prog so the user is aware to put the \ in). I
learned that one the hard way after copying 20meg of files and wondering
where they went.

as for the debug.print stuff wouldn't it be

sSource would be c:\update
sDestination would be txtdest
and sFiles is *.*
the only part of the prog where the user has any input is txtdest everything
else is hard coded into the prog.

what i need is to find a way for sDestination to be both txtdest and also to
include its sub dir's

basically to copy c:\update and all its sub dir's AS IS to the dest.

i though about writing a batch file and having the vb prog do something like

batch.bat /subdir        where batch.bat is the batch file and subdir would
be the name of the sub dir. So vb could maybe scan the dest folder and put
the relevant /subdir names in for me, but i figured that would be a little
to hard.

thanx
steve



Thu, 28 Aug 2003 07:50:53 GMT  
 copying file to sub dir

Quote:

>Some are going to wonder what rgbCopyFiles() is (my initials).

Damn... I thought it was CopyFile with file colors preserved. ;-)
Regards, Frank.


Thu, 28 Aug 2003 08:46:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. copying file to sub dir

2. copying file to sub dir

3. Detect new/removed files from Dir + sub-dirs ?

4. output filenames and Folders to a text file in a dir and all subs

5. output filenames to a text file in a dir and all subs

6. Copy file to another dir with new name.

7. How to copy dir &files/beginner level

8. Copying files to WinNT dir via logon script?

9. Copy files with sub folder

10. Copy the files and sub folders to another folder

11. Get first sub dir

12. How to check the size of a sub-dir

 

 
Powered by phpBB® Forum Software