| Uutiset | Koodikirjasto | Wiki | Keskustelut | FAQ | Info |
CDVerify CSharpraspi 20.11.04 11:38 Tarkistaa onko hakemistorakenne ISO 9660 -yhteensopiva
/* * CDVerify * Tarkistaa onko hakemistorakenne ISO 9660 -yhteensopiva * Tulostaa kaikki rikkinäiset tiedostot. * Neron kitinä rupes ottamaan päähän :P * * Pekka Järvinen 2004 * * Käyttö: * Mene polttohakemistoon ja kirjoita esim: * cdverify > c:\rikki.txt * Sitten kattelet tuota rikki.txt:tä. * Tai teet uudelleennimeämispätkän tyyliin: * cdverify | <ohjelma joka uudelleennimeää tiedostot 64 merkin mittaisiksi> */ using System; using System.IO; namespace DefaultNamespace { class CDVerify { const bool debugmode = false; public static void Main(string[] args) { string hakemisto = "."; ProcessDir(hakemisto, 0); } // /MAIN public static void ProcessDir(string sourceDir, int recursionLvl) { string[] fileEntries = Directory.GetFiles(sourceDir); foreach (string fileName in fileEntries) { // basename string fn = new FileInfo(fileName).Name; if(debugmode == true) { Console.WriteLine("DIR: \"{0}\" FILE: \"{1}\" FILELEN:{2} DIRLEN:{3} TOTALLEN:{4} ", sourceDir, fn, fn.Length, sourceDir.Length, fn.Length + sourceDir.Length); } bool compliant = true; string err = null; if (recursionLvl >= 8) { err = "directory level >= 8"; compliant = false; } if (sourceDir.Length >= 255) { err = "directory length >= 255"; compliant = false; } if (fn.Length >= 64) { err = "filename length >= 64"; compliant = false; } if ((sourceDir.Length + fn.Length) >= 255) { err = "directory & filename length >= 255"; compliant = false; } // show error if (!compliant) { Console.WriteLine("{0}: {1}", err, fileName); } } // /foreach string[] subdirEntries = Directory.GetDirectories(sourceDir); foreach (string subdir in subdirEntries) if ((File.GetAttributes(subdir) & FileAttributes.ReparsePoint) != FileAttributes.ReparsePoint) ProcessDir(subdir, recursionLvl+1); } // /method } // /class } // namespace |
![]() Haku
|