First of all, i'm a Graphic designer so please ignore if this programming question seems stupid ... I know this question could've been split into two or three smaller questions but since I'm really new to coding VB.NET it would've killed me trying to put together the stuff ...
Directory Structure: I have a directory structure as follows;
ad_folder
--folderA
--folderB
--folderC
--anotherFolder
--etcfolder
--afile.aspx
--anotherfile.gif
ad_code
--folderA
--folderB
--afile.aspx
--anotherfile.gif
ad_prep
--folderA
--etcfolder
--afile.aspx
--anotherfile.gif
ad_bin
--etcfolder
--afile.aspx
--anotherfile.gif
other Folder
files folder
assetsfolder
index.aspx
web.config
image.gif
Task at hand:
I want code in VB.NET to create javascript arrays of the folder contents that can then be used on the client end. I only need arrays for all folders contained in folders starting with ad_ and an array for all the base folders . like so:
var folders=["ad_folder","ad_code","ad_prep","ad_bin"];
var ad_folder=["folderA","folderB","folderC","anotherFolder","etcfolder"];
var ad_code=["folderA","folderB"];
var ad_prep=["folderA","etcfolder"];
var ad_bin=["etcfolder"];
Please note that I do not know the number of or the names of the folders, they can be different in different cases, I only have the root path. sorry for sounding stupid.
I'll appriciate any help anyone can provide ... I'm super new to programming, I've googled on how I can display folder contents in VB.net and the code worked but couldn't figure out how to create the arrays and display only folders within folders starting with "ad_".
Thankyou soooooo much ... :) ... If anyone needs any graphic design / photoshop help ... I'll be glad to ;) ... just let me know.
UPDATE : okay ... by googling I know :
System.IO.DirectoryInfo and System.IO.FileInfo to be used for getting the folders.
A literal control can be used to create javascript arrays in ASP.NET. These js arrays can then be used on the client side.
The pseudo for what I want would be something like;
declare path if path exists and is not empty then ' get all folders starting with 'ad_' ' if folders starting with 'ad_' are > 0 ' loop through all folders starting with 'ad_' ' ' if this folder exists and not empty ' ' get all folders within this folder ' ' create literal control for javascript array named 'this folder's name' ' create literal control for javascript array called 'folders' containing names of all folders starting with 'ad_'.