using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Security; using System.Security.Permissions; namespace ConsoleApplication2 { class Class1 { StreamWriter sw = new StreamWriter("D:\\contents.txt"); public void getfil(String path) { string[] p = Directory.GetFiles(path); for (int j = 0; j < p.Length; j++) { sw.WriteLine(p[j]); Console.WriteLine(p[j]); } } public void getfol(string path) { int i; try { string[] a = Directory.GetDirectories(path); for ( i = 0; ; i++) { sw.WriteLine(a[i]); Console.WriteLine(a[i]); bool isa = ((File.GetAttributes(a[i]) & FileAttributes.System) == FileAttributes.System); if (isa == true) { sw.WriteLine("Idetifier"); Console.WriteLine(""); i++; } if (Directory.GetDirectories(a[i]).Length > 0) { getfol(a[i]); } if (Directory.GetFiles(a[i]).Length > 0) { getfil(a[i]); } } sw.Close(); Console.WriteLine("Done"); } catch (Exception e) { } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)