diff --git a/HomeworksDircAndFile/Program.cs b/HomeworksDircAndFile/Program.cs index 6fb8f0f..ee92091 100644 --- a/HomeworksDircAndFile/Program.cs +++ b/HomeworksDircAndFile/Program.cs @@ -4,7 +4,38 @@ internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + Console.Write("Enter the path : "); + string path = Console.ReadLine(); + + Console.WriteLine(GetDirectoryContent(path)); + } + + public static string GetDirectoryContent(string path) + { + if(Directory.Exists(path)) + { + if (Directory.GetFiles(path).Length == 0 && Directory.GetDirectories(path).Length == 0) + { + return "Papka bo'sh"; + } + else if (Directory.GetFiles(path).Length == 0) + { + return "Papkalr bor"; + } + else if (Directory.GetDirectories(path).Length == 0) + { + return "Fayllar bor"; + } + else + { + return "Papkalar va fayllar bor"; + } + } + + else + { + return "Path ni xato kiritdingiz "; + } } } } \ No newline at end of file