Mehmet Akif Akkus

Bir Bilgisayar Mühendisinin Günlüğü

Wednesday, Feb 08th

Last update:01:05:22 PM GMT

Headlines:
RSS
You are here: Projeler Programlama Bil341_0910_Dosya ilgilerini elde etme

Bil341_0910_Dosya ilgilerini elde etme

e-Posta Yazdır PDF
Aşağıdaki kod ile dosya isimleri elde ediliyor
 
// Get an array of file names as strings rather than FileInfo objects.
// Use this method when storage space is an issue, and when you might
// hold on to the file name reference for a while before you try to access
// the file.
string[] files = System.IO.Directory.GetFiles(currentDirName, "*.txt");

foreach (string s in files)
{
// Create the FileInfo object only when needed to ensure
// the information is as current as possible.
System.IO.FileInfo fi = null;
try
{
fi = new System.IO.FileInfo(s);
}
catch (System.IO.FileNotFoundException e)
{
// To inform the user and continue is
// sufficient for this demonstration.
// Your application may require different behavior.
Console.WriteLine(e.Message);
continue;
}
Console.WriteLine("{0} : {1}",fi.Name, fi.Directory);
}

Yorumlar  

 
0 # 2010-12-14 13:09
bu da dosya ilgileri olmus
Cevap | Alıntı | Alıntı
 

Yorum ekle


Güvenlik kodu
Yenile