sir i have this question... I do have 3 folders in drive D:/ namely :Backup, Trea and Inven..

now wat I want to happen using VB 6.0 is dat should have a button in my program
that will automatically copy the two folders (Trea and Inven) and in Backup folder
it will automatically create a new folder where the copied folders (Trea and Inven)
will be saved..

Recommended Answers

try this

Dim fso As New FileSystemObject

fso.CopyFolder "d:\trea", "d:\backup"
fso.CopyFolder "d:\inven", "d:\backup"

before putting this code first add references and so goto project menu and then select references option and then select Microsoft Scripting Runtime

hope this helps you . . .

Jump to Post

All 2 Replies

try this

Dim fso As New FileSystemObject

fso.CopyFolder "d:\trea", "d:\backup"
fso.CopyFolder "d:\inven", "d:\backup"

before putting this code first add references and so goto project menu and then select references option and then select Microsoft Scripting Runtime

hope this helps you . . .

try using this....

    Dim fs As New Scripting.FileSystemObject
    Set fs = New Scripting.FileSystemObject
    fs.CopyFolder SourcePath, DestinationPath
    Set fs = Nothing

where
SourcePath : Path of your source folder
DestinationPath : Path of your destination folder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.