Hi all i'm newbie here and I want to learn VB6. I'll try to make copyfolder.. anyone can help??
thx
[ask] created copy folder[ask] created copy folder
Page 1 of 1
2 Replies - 1536 Views - Last Post: 09 May 2009 - 10:36 AM
Replies To: [ask] created copy folder
#2
Re: [ask] created copy folder
Posted 09 May 2009 - 08:29 AM
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Post your code like this:
Thanks.
Post your code like this:
Thanks.
#3
Re: [ask] created copy folder
Posted 09 May 2009 - 10:36 AM
PsychoCoder, on 9 May, 2009 - 07:29 AM, said:
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Post your code like this:
Thanks.
Post your code like this:
Thanks.
here they are my script
Dim oFSO, oSourceFolder, oTargetFolder
Private Sub Command1_Click()
CreateFolder "e:\destination\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oSourceFolder = oFSO.GetFolder(App.Path & "\source\")
Set oTargetFolder = oFSO.GetFolder("e:\destination\")
RecursiveCopy oSourceFolder, oTargetFolder, False
End Sub
Private Sub RecursiveCopy(ByRef oSource, ByRef oTarget, ByVal bOverWrite)
Dim oFolder, oFile, szPath
For Each oFile In oSource.Files
szPath = Replace(oTarget.Path & "\" & oFile.Name, "\\", "\")
If Not (oFSO.FileExists(szPath) And bOverWrite) Then oFile.Copy szPath, bOverWrite
Next
For Each oFolder In oSource.Subfolders
szPath = Replace(oTarget.Path & "\" & oFolder.Name, "\\", "\")
If Not (oFSO.FolderExists(szPath) And bOverWrite) Then
Set oNewTarget = oFSO.CreateFolder(szPath)
Else
Set oNewTarget = oSO.GetFolder(szPath)
End If
RecursiveCopy oFolder, oTarget, bOverWrite
Next
End Sub
Private Sub CreateFolder(foldername As String)
Dim fso As New FileSystemObject
Dim fldr As Folder
On Error GoTo FolderError
Set fldr = fso.CreateFolder(foldername)
Set fldr = Nothing
Set fso = Nothing
Exit Sub
FolderError:
Exit Sub
Resume Next
End Sub
error code run-time error '76' path not found, i'll have checklist Microsoft scripting runtime.
I want to copy directory folder at e:\source\ to e:\destination\
any suggest? sorry i'm beginer
thanks
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|