Hi!

We have a bunch of text files saved in a directory as unicode. These files will be imported to a non unicode database. And for this to work we must write a batch file (console) that can do the following:

Read all files from directory1
Convert the content to ASCII
Write the file to directory2 with same filename

I already have a program for this, but I wonder, is there a way to improve it using the new VS 2008 techniques such as LINQ?

Code:
Module Main
    Function Main(ByVal args() As String) As Integer
        Dim f As String = String.Empty
        Try
            If args.Length < 2 Then
                Console.WriteLine("Please insert full start directory and output directory as arguments")
                Return 99
            Else
                For Each f In Directory.GetFiles(args(0))
                    Try

                        Dim text As String = File.ReadAllText(f, Encoding.Default)
                        Dim fileName As String = f.Substring(f.LastIndexOf("\") + 1, f.Length - f.LastIndexOf("\") - 1)
                        File.WriteAllText(args(1) + "\" + fileName, text, Encoding.ASCII)
                    Catch ex As Exception
                        Console.WriteLine(String.Format("The file {0} was unable to covert, skipping"), f)
                    End Try
                Next f
            End If
            Console.WriteLine("Finished successfully")
            Return 0
        Catch ex As Exception
            Return 99
        End Try

    End Function

End Module
Second question, how do I convert to ANSI insteaad of ASCII?

kind regards
Henrik