By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

All Files copy from a folder to other folder

P: 89
Hi all, i have problem with vb6 that copy all files from a folder to other, such as
Source is "D:\Test" and files are a.txt, b.doc. c.dgw: Distination folder is "D:\Test2" , could u pls give some idea abt this, thx advance, shaif
Dec 27 '07 #1
Share this Question
Share on Google+
4 Replies


VijaySofist
100+
P: 107
Hi all, i have problem with vb6 that copy all files from a folder to other, such as
Source is "D:\Test" and files are a.txt, b.doc. c.dgw: Distination folder is "D:\Test2" , could u pls give some idea abt this, thx advance, shaif
Hi!

This can be achieved in 2 Ways
1. You can use Directory List Box
Now you can set the path of the Directory List Box to D:\Test
Then use FileCopy Command in Loop to Copy all the files from source directory to the destination directory.

2. You can use the File System Object.
For this you have to include the reference Microsoft Scripting Runtime . By Using this you can copy Full Source Folder contents to the destination.

All The Best

With Regards
Vijay. R
Dec 27 '07 #2

Ali Rizwan
100+
P: 927
Hi all, i have problem with vb6 that copy all files from a folder to other, such as
Source is "D:\Test" and files are a.txt, b.doc. c.dgw: Distination folder is "D:\Test2" , could u pls give some idea abt this, thx advance, shaif
Use this code for copying files.

Expand|Select|Wrap|Line Numbers
  1. filecopy "C:\Test","D:\Test"
You can use also fso.

Give refrence and then do this:

Expand|Select|Wrap|Line Numbers
  1. Dim fso As New FileSystemObject
  2.  
  3. Private Sub Command1_Click()
  4.  
  5. fso.CopyFile "C:\Test","D:\Test"
  6.  
  7. End Sub
Regards

>> ALI <<
Dec 27 '07 #3

P: 89
Hi Vijay.
Tha a lot ur code working well, Shaif
Dec 27 '07 #4

P: 43
Hello,

I am having more or less the same problem but my source is a dynamic filepath with filename written into a textbox by drag and drop at run time. Other than that is I am also trying to copy each different file/s "x" times to their destination folder.

Any idea how to do that?

This is how they are being added by the way at run time.
Expand|Select|Wrap|Line Numbers
  1. Private Sub DropArea_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
  2. Dim i As Integer
  3. Dim dCount As Integer
  4.  
  5.       On Error GoTo No_File_info
  6.       i = Text1.count - 1
  7.  
  8.       For dCount = 1 To Data.Files.count
  9.  
  10.          Load Text1(i + dCount)
  11.          With Text1(i + dCount)
  12.             .Top = Text1(i + dCount - 1).Top + Text1(0).Height
  13.             .Text = (Data.Files.Item(dCount))
  14.             .Visible = True
  15.  
  16.          End With
  17.  
  18.          Load CopyTimes(i + dCount)
  19.          With CopyTimes(i + dCount)
  20.             .Top = CopyTimes(i + dCount - 1).Top + CopyTimes(0).Height
  21.             '.Text = i + dCount
  22.             .Visible = True
  23.          End With
  24.  
  25.  
  26.       Next
  27.       FrameSlide.Height = Text1.count * Text1(0).Height
  28.       If FrameSlide.Height > FrameFix.Height Then
  29.          With VScrollFiles
  30.             .Max = (FrameSlide.Height - FrameFix.Height) / 10
  31.             .SmallChange = 200
  32.             .LargeChange = FrameFix.Height / 10
  33.             .Visible = True
  34.          End With
  35.       Else
  36.          VScrollFiles.Visible = False
  37.       End If
  38. Exit Sub
  39. No_File_info:
  40.    MsgBox "No File name from Explorer"
  41. End Sub
  42.  
That creates 2 textboxes in one row. Wherein 1st textbox contains the full path with filename of the file selected and 2nd textbox contains the number of copies , each selected file is to be copied.

Now how do I put a code to copy that to a dynamic destination as well? I have a SaveTo textbox where I specify a destination path.

Please help.. Thank You!
Jan 4 '11 #5

Post your reply

Sign in to post your reply or Sign up for a free account.