Clear Directory - CSharp File IO

CSharp examples for File IO:Directory

Description

Clear Directory

Demo Code


using System.IO ;
using System.Windows.Forms ;
using System;/*from  w  ww  . j a v  a  2  s.c o  m*/

public class Main{
        public static void ClearDirectory(string dirPath)
        {
            string[] filePaths = Directory.GetFiles(dirPath);
            foreach (string file in filePaths)
            {
                File.Delete(file);
            }
        }
}

Related Tutorials