C# Directory.GetDirectories Output to string -
string[] directory = directory.getdirectories(path, criteria)
using above , system.diagnostics.process.start(directory)
can open multiple directory meet criteria - criteria being name of folder in directory.
how take output of system.diagnostics.process.start(directory)
, convert string, rather open directory?
all subfolders within directories open, have same folder structure, navigate specific subfolders within these directories; way can think of doing that, redirecting system.diagnostics.process.start(directory)
output string, , adding rest of folder path such @'\photos'
output string , using system.diagnostics.process.start(newpath);
on new folder path.
if has better way of doing i'm ears. full code below:
string path = @"c:\projects\"; string criteria = "*" + textbox1.text + "*"; string[] dir = directory.getdirectories(path, criteria); foreach (string directory in dir) { system.diagnostics.process.start(directory); }
to list of folders within folder, can use same method directory.getdirectories()
string path = @"c:\projects\"; string criteria = "*" + textbox1.text + "*"; string[] dir = directory.getdirectories(path, criteria); foreach (string directory in dir) { string newcriteria = "photos"; string[] subdir = directory.getdirectories(directory, newcriteria); foreach (string subdirectory in subdir) { system.diagnostics.process.start(subdirectory); } }
Comments
Post a Comment