Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Folder Contents help!!

Status
Not open for further replies.

mrclasik

Technical User
Dec 16, 2004
18
US
Hi there, I am trying to copy the contents of a folder when the name isn't allways known. I need to get the name of the folder and then use that name to copy the folder contents. The path is like so.. appdata/mozilla/profiles/ the folder name could be anything such as 42ndz6y7.default. Is this possible. I am new to VBS and would really appreciate some help on this.


Thanks for any help..
 
A starting point:
Function PickFolder(strStartDir)
Dim SA, f
Set SA = CreateObject("Shell.Application")
Set f = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not f Is Nothing) Then
PickFolder = f.Items.Item.path
End If
Set f = Nothing
Set SA = Nothing
End Function
MsgBox PickFolder("")

For the copy stuff have a look at FileSystemObject (aka fso)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's cool PH, any way to take that info and to the next stage after clicking okay. Let me futher complicate it by asking if there is a way to default select folder to appdata/mozilla/firefox/profile for instance.

Man, I have to learn this VBS stuff..

Thanks..
 
Set strStartDir to your base folder - note this will become the root of the BrowseForFolder dialog

using PHV's example

MsgBox PickFolder("c:\windows") will make c:\windows the start position.


Hope this helps.
 
Okay, got that, now is there anyway to copy the contents of that folder selected including all subfolders and files to anothere directory..?. Almost there...

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top