1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Open an existing file, or create a new one.
//FileInfo fi = new FileInfo("temp.txt");
FileInfo fi = new FileInfo("ReBuild.cmd");
// Determine the full path of the file just created.
DirectoryInfo di = fi.Directory;
// Figure out what other entries are in that directory.
FileSystemInfo[] fsi = di.GetFileSystemInfos();
string[] mesFichiers =
(from fi in Directory.EnumerateFiles(@"d:\","test.cmd")
select fi.FullName).ToArray();
Console.WriteLine("The directory '{0}' contains the following files and directories:", di.FullName);
//Console.ReadLine();
// Print the names of all the files and subdirectories of that directory.
foreach (FileSystemInfo info in fsi)
Console.WriteLine(info.Name);
Console.ReadLine();
}
}
} |
Partager