tfsaccount
asked on
How to recursively add missing directories
How do I recursively add any required (missing) subdirectories using FSO?
For example, I want to have a function that will accept a folder name such as C:\folder1\folder2\folder3
What I need is to create any missing folders from that full path.
So if I already have C:\folder1 and it already has folder2, I want folder3 to be created. When I pass the full path name, I dont know what folders, if any, already exist.
If I don’t have ANY of the folders, I want the entire path to be created.
I could pass \\server\directory\folder1 \folder2\f older3 or U:\Reports\Sales\2007\
I can verify that the server/drive exists… but not how to recursively build the list of folders.
I can verify that there is no filename in that list… all I need is a function (or functions) that will make sure that the entire directory specified exists. So by the time the function is done, I don’t have to check does folder exist or anything like that.
Thanks!
For example, I want to have a function that will accept a folder name such as C:\folder1\folder2\folder3
What I need is to create any missing folders from that full path.
So if I already have C:\folder1 and it already has folder2, I want folder3 to be created. When I pass the full path name, I dont know what folders, if any, already exist.
If I don’t have ANY of the folders, I want the entire path to be created.
I could pass \\server\directory\folder1
I can verify that the server/drive exists… but not how to recursively build the list of folders.
I can verify that there is no filename in that list… all I need is a function (or functions) that will make sure that the entire directory specified exists. So by the time the function is done, I don’t have to check does folder exist or anything like that.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@jasonduan
>> Simply call System.IO.Directory.Create Directory( directoryN ame) with the full path,
In classic VB? I believe you're thinking of .NET :)
>> Simply call System.IO.Directory.Create
In classic VB? I believe you're thinking of .NET :)
sorry, i was thinking of .net.
ASKER
Thanks!!!
NP. Glad to help :)
Simply call System.IO.Directory.Create