Created
January 15, 2018 23:24
-
-
Save tonerdo/07bc4389038bf1b7b74f1e6c0da25a37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
namespace Branches.Net | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int level = 0; | |
void ListDirectoryContents(string directory) | |
{ | |
level++; | |
foreach (var dir in Directory.GetDirectories(directory)) | |
{ | |
Console.WriteLine("{0} {1}", "|".PadRight(level * 3, '_'), Path.GetFileName(dir)); | |
ListDirectoryContents(dir); | |
} | |
foreach (var file in Directory.GetFiles(directory)) | |
Console.WriteLine("{0} {1}", "|".PadRight(level * 3, '_'), Path.GetFileName(file)); | |
level--; | |
} | |
ListDirectoryContents(Directory.GetCurrentDirectory()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment