.net - How do I find greater number folder from root folder path using c#? -
i have 3 folders in controllers
folder z1
, z2
, z3
how compare , find out z3
greater among listed folders?
this code give me folder depth .
public static int folderdepth(string path) { if (string.isnullorempty(path)) return 0; directoryinfo parent = directory.getparent(path); if (parent == null) return 1; return folderdepth(parent.fullname) + 1; }
greater means in name 3 greater 2 &1 z3 greater. out put should z3
var directory = directory.getdirectories(path) .orderbydescending(dir => dir) .firstordefault();
now, may have problem. supposed "greater", z15
or z2
? , how computer find out? folders follow pattern?
Comments
Post a Comment