[Mono-bugs] [Bug 72728][Wis] New - Directory.GetFiles error

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 18 Feb 2005 13:06:21 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by lkarunungan@yahoo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=72728

--- shadow/72728	2005-02-18 13:06:21.000000000 -0500
+++ shadow/72728.tmp.19528	2005-02-18 13:06:21.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 72728
+Product: Mono: Class Libraries
+Version: 1.0
+OS: GNU/Linux [Other]
+OS Details: Debian Sarge
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lkarunungan@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Directory.GetFiles error
+
+Hi, I created a simple program for changing file names to lower case. I
+used the Directory.GetFiles method to get a listing based on the given
+parameter for the program.
+
+Here is the error and stack trace I am getting.
+
+Win32 IO returned ERROR_SUCCESS. Path: TEST
+in <0x00231> System.IO.Directory:GetFileSystemEntries
+(string,string,System.IO.FileAttributes,System.IO.FileAttributes)
+in <0x00018> System.IO.Directory:GetFiles (string,string)
+in <0x00010> System.IO.Directory:GetFiles (string)
+in <0x000ab> App:Main (string[])
+
+Here is the source code:
+
+using System;
+using System.IO;
+
+class App
+{
+	public static void Main(string[] args)
+	{
+		try
+		{
+			if(args.Length < 1)
+				Console.Error.WriteLine("usage: ftolower [files]");
+			else
+			{
+				foreach(string mask in args)
+				{
+					string[] files = Directory.GetFiles(mask);
+					
+					foreach(string file in files)
+					{
+						string name = Path.GetFileName(file);
+						
+						name = name.ToLower();
+						
+						string newFile = Path.Combine(Path.GetDirectoryName(file), name);
+						
+						if(!File.Exists(newFile))
+						{
+							File.Move(file, newFile);
+							
+							Console.Write(file);
+							Console.Write(" --> ");
+							Console.WriteLine(newFile);
+						}
+					}
+				}
+			}
+		}
+		catch(Exception err)
+		{
+			Console.Error.WriteLine(err.Message);
+			Console.Error.WriteLine(err.StackTrace);
+		}
+	}
+}