Difference between revisions of "6237 Programmering II (Csharp) Agenda/File browser"

From Teknologisk videncenter
Jump to: navigation, search
(Directory)
 
(No difference)

Latest revision as of 11:22, 7 October 2015

Directory

Hvis du gerne vil arbejde med filerne på din computer kan det gøres med Directory.


String[] dirs = Directory.GetDirectories("C:\\");
foreach (string dir in dirs)
{
	System.Console.WriteLine(dir);
}

String[] files = Directory.GetFiles("C:\\");
foreach (string file in files)
{
	System.Console.WriteLine(file);
}

File.Copy("xxx.txt", "yyy.txt");
File.Delete("xxx.txt");