473,387 Members | 1,899 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,387 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 17065
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.