How to

get content of directory

Published: 13. December 2008 | Updated: 26. October 2011
License: Microsoft Public License (MS-PL)
Categories: File system » Directories, File system
Tags: C# Windows
Was this snippet helpful for you? YESYES / NONO

Get sub directories and files of specified directory

Import namespace

using System.IO;

Code

string path = @"C:\Folder\";

string[] files = Directory.GetFiles(path);
string[] directories = Directory.GetDirectories(path);
string[] filesAndDirectories = Directory.GetFileSystemEntries(path);
Send us feedback about this snippet »



Related Snippets: