Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion HomeworksDircAndFile/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ";
}
}
}
}