public class FsTools { public static int makedir( string dir, int depth ) { int rc = -1; if( Directory.Exists( dir ) ) { rc = 0; } else if( depth >= 0 ) { rc = makedir( Path.GetDirectoryName( dir ), depth - 1 ); if( rc >= 0 ) { Directory.CreateDirectory( dir ); rc++; } } return rc; } }