473,320 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

All Files copy from a folder to other folder

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
4 17053
VijaySofist
107 100+
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
925 512MB
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
shaiful
89
Hi Vijay.
Tha a lot ur code working well, Shaif
Dec 27 '07 #4
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

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

Similar topics

3
by: larry | last post by:
i would like to write a vb program to copy the contents of folder one to folder two. Folder one contains 30 folders with 10 files each.
8
by: vinesh | last post by:
I have sample Asp.Net Web Application project. Let me know how to keep the files related to this project (like the webform.aspx, WebForm1.aspx.vb, WebForm1.aspx.resx) in a separate folder within a...
6
by: Julien | last post by:
Hello, I have some files located in a file server and managed by a SQL database from a web based interface using ASP + VBSCRIPT technology. I need to automatically copy those files to a web...
2
by: Dámaso Velázquez Álvarez | last post by:
Hi, I need to copy files to a shared folder protected by username/password. I don't now autenticate me in the server to copy the files. Do I need to use the credentials to do it? How can i do...
5
by: wwwmike | last post by:
I have an asp.net 2.0 application where I move about 200,000 text files daily in and out. When using VS 2005 to debug my application everything works find if only a few files are in the folder....
2
by: queanbeyan | last post by:
Hi I have found that many of my potential users of my application are not able to write to their program files directory on C:\program files, however they have access to 'My documents'. i...
3
by: D2 | last post by:
Hi, I am working on an application which have web as well as windows portions. We have some common dlls that are shared by both windows and web. To make it more maintainable, we want to place...
3
by: rhepsi | last post by:
Hii all, i have a source folder, i have many .jpg files .. Now i want all the .jpg files to be copied into new folder... can anyone plz help me.... How to copy all the files from 1...
2
by: sebouh181 | last post by:
Hi, I have a Windows Service that copies xml files from a shared folder on the server. I am using System.IO.File.Copy(\\Server-Name\SharedDir) method. But whenever I try to copy files there is...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.