![]() |
Nested directories from Treeview
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 |
Nested directories from Treeview
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 "Satish" wrote in message oups.com... 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 |
Nested directories from Treeview
Awesome!
That solved my problem! It is definitely a much cleaner way than using the MkDir statement. Thanks a lot Nick! Satish :-) NickHK wrote: 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 "Satish" wrote in message oups.com... 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 |
All times are GMT +1. The time now is 10:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com