Skip to content

Instantly share code, notes, and snippets.

@tonerdo
Created January 15, 2018 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonerdo/07bc4389038bf1b7b74f1e6c0da25a37 to your computer and use it in GitHub Desktop.
Save tonerdo/07bc4389038bf1b7b74f1e6c0da25a37 to your computer and use it in GitHub Desktop.
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