Copy all folder contents to specified location(pls help)

Thread Solved

Join Date: Jan 2009
Posts: 122
Reputation: blocker is an unknown quantity at this point 
Solved Threads: 0
blocker's Avatar
blocker blocker is offline Offline
Junior Poster

Copy all folder contents to specified location(pls help)

 
0
  #1
Mar 28th, 2009
Good day!.

I want to copy all the folder contents to a certain location. To be specific, i have a folder named (webproject) relative on my vb program path.When the form load, i want to copy all the content of this folder(webproject) to C:\wamp\wwww\onlineweb\.I just really dont know how to start the coding. If someone can help me to solve this problem thank you very many much

God bless on this mother earth.
Last edited by blocker; Mar 28th, 2009 at 7:40 am.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,102
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 91
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: Copy all folder contents to specified location(pls help)

 
0
  #2
Mar 28th, 2009
check this out from MS site... filecopy function
hope it helps

http://msdn.microsoft.com/en-us/libr...4y(VS.80).aspx

or this one for example on how to use filecopy...

http://www.vbforums.com/showthread.php?t=354738
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 122
Reputation: blocker is an unknown quantity at this point 
Solved Threads: 0
blocker's Avatar
blocker blocker is offline Offline
Junior Poster

Re: Copy all folder contents to specified location(pls help)

 
0
  #3
Mar 28th, 2009
Originally Posted by cguan_77 View Post
check this out from MS site... filecopy function
hope it helps

http://msdn.microsoft.com/en-us/libr...4y(VS.80).aspx

or this one for example on how to use filecopy...

http://www.vbforums.com/showthread.php?t=354738
thank you for immediate reply.Im gonna update the result after.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 35
Reputation: koolsid is an unknown quantity at this point 
Solved Threads: 6
koolsid's Avatar
koolsid koolsid is offline Offline
Light Poster

Re: Copy all folder contents to specified location(pls help)

 
0
  #4
Mar 28th, 2009
I have always loved the power of API's

This will help you...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Declare Function SHFileOperation Lib "shell32.dll" _
  2. Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
  3.  
  4. '~~> Copy File/Folder
  5. Private Const FO_COPY = &H2
  6. '~~> Does not display file names
  7. Private Const FOF_SIMPLEPROGRESS = &H100
  8.  
  9. Private Type SHFILEOPSTRUCT
  10. hWnd As Long
  11. wFunc As Long
  12. pFrom As String
  13. pTo As String
  14. fFlags As Integer
  15. fAnyOperationsAborted As Long
  16. hNameMappings As Long
  17. lpszProgressTitle As Long
  18. End Type
  19.  
  20. Private Sub VBCopyFolder(ByRef strSource As String, ByRef strTarget As String)
  21. Dim op As SHFILEOPSTRUCT
  22. With op
  23. .wFunc = FO_COPY
  24. .pTo = strTarget
  25. .pFrom = strSource
  26. .fFlags = FOF_SIMPLEPROGRESS
  27. End With
  28.  
  29. '~~> Perform operation
  30. SHFileOperation op
  31. End Sub
  32.  
  33. Private Sub Command1_Click()
  34. '~~> Copy Folder C:\temp\1 to C:\temp\2
  35. '~~> Change this to relevant folders
  36. Call VBCopyFolder("C:\temp\1", "C:\temp\2")
  37. End Sub
A good excercise for the Heart is to bend down and help another up...

Please Mark your Thread "Solved", if the query is solved...

==>If a post has helped you then Please Rate it!
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 809
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Copy all folder contents to specified location(pls help)

 
0
  #5
Mar 28th, 2009
name oldfile as newfile

will do the same...

Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 122
Reputation: blocker is an unknown quantity at this point 
Solved Threads: 0
blocker's Avatar
blocker blocker is offline Offline
Junior Poster

Re: Copy all folder contents to specified location(pls help)

 
0
  #6
Mar 29th, 2009
Thank you guys. I havent try it yet. I will do this now. I know this will work.as i can look at the code. I have read thid API already. I will mark this problem solved.

Thank you very much guys again. Hope to see you all on next thread.!

God bless on this mother earth.
Last edited by blocker; Mar 29th, 2009 at 9:33 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC