Nested directories from Treeview

S

Satish

Hi All:

I would like to know if there is a simple and efficient way to create
folders on a selcted drive (or location) based on the structure that is
present in a Treeview.

I basically have the Treeview created. The only thing the user has to
do is select a drive (or location) and click a button that will create
the folders with all the subfolders at the specified location. All the
folder names have to be taken from the Treeview nodes. (text of the
nodes)

I was thinking of using the MkDir statement with recursive calls
(probably recursion is the only way to get all nodes in a Treeview),
but I am not sure if that is the correct or most efficient way.

Any ideas/thoughts?

Thanks
Satish
 
N

NickHK

Satish,
<From API-Guide: http://www.allapi.net/>

The MakeSureDirectoryPathExists function creates all the directories in the
specified DirPath, beginning with the root.

Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll"
(ByVal lpPath As String) As Long

Private Sub Form_Load()
'create the directory "c:\this\is\a\test\directory\", if it doesn't
exist already
MakeSureDirectoryPathExists "c:\this\is\a\test\directory\"
End Sub
</From API-Guide>

Although repeated calls to MkDir would work also.

NickHK
 
S

Satish

Awesome!

That solved my problem! It is definitely a much cleaner way than using
the MkDir statement.

Thanks a lot Nick!
Satish
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top