how to Read folder contents [modified]
-
Hi, I am creating a windows application,that contains a folder,with 5 files. how to programaticlly get the names of all the files in that folder(getting names of all the contents of that folder) Say folder name is "MyXMLFolder" .It contains elemnts as -Customer.xml -Employee.Xml -Bank.xml I want c# coding to get all the names of the files in "MyXMLFolder" folder -- modified at 2:13 Monday 13th August, 2007
-
Hi, I am creating a windows application,that contains a folder,with 5 files. how to programaticlly get the names of all the files in that folder(getting names of all the contents of that folder) Say folder name is "MyXMLFolder" .It contains elemnts as -Customer.xml -Employee.Xml -Bank.xml I want c# coding to get all the names of the files in "MyXMLFolder" folder -- modified at 2:13 Monday 13th August, 2007
DirectoryInfo dir = new DirectoryInfo(@"F:\MyFolder"); FileInfo[] files = dir.GetFiles("*.*"); Foreach(FileInfo f in files ) { Console.WriteLine("Name is : {0}", f.Name); Console.WriteLine("Length of the file is : {0}", f.Length); Console.WriteLine("Creation time is : {0}", f.CreationTime); Console.WriteLine("Attributes of the file are : {0}", f.Attributes.ToString()); }
Ref: Working with Files in C#[^] File Information using C#[^] Hope it helps.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Hi, I am creating a windows application,that contains a folder,with 5 files. how to programaticlly get the names of all the files in that folder(getting names of all the contents of that folder) Say folder name is "MyXMLFolder" .It contains elemnts as -Customer.xml -Employee.Xml -Bank.xml I want c# coding to get all the names of the files in "MyXMLFolder" folder -- modified at 2:13 Monday 13th August, 2007
-
Thank you ,It is working
-
DirectoryInfo dir = new DirectoryInfo(@"F:\MyFolder"); FileInfo[] files = dir.GetFiles("*.*"); Foreach(FileInfo f in files ) { Console.WriteLine("Name is : {0}", f.Name); Console.WriteLine("Length of the file is : {0}", f.Length); Console.WriteLine("Creation time is : {0}", f.CreationTime); Console.WriteLine("Attributes of the file are : {0}", f.Attributes.ToString()); }
Ref: Working with Files in C#[^] File Information using C#[^] Hope it helps.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Thank you, for detailed description, working