CSharp examples for File IO:Path
Determine If a Path Is a Directory or a File
using System;// ww w . ja v a2s. c o m using System.IO; static class MainClass { static void Main(string[] args) { foreach (string arg in args) { Console.Write(arg); if (Directory.Exists(arg)) { Console.WriteLine(" is a directory"); } else if (File.Exists(arg)) { Console.WriteLine(" is a file"); } else { Console.WriteLine(" does not exist"); } } } }