Sub RenameFile(SrcDir As String, SrcFilename As String, DestDir As String, DestFilename As String, Replace As Boolean) As Boolean 'ignore warning
Dim R As Reflector, NewObj As Object, New As String , Old As String
If SrcFilename = Null Or DestFilename = Null Or SrcDir = Null Or DestDir = Null Then Return False
If File.Exists(SrcDir, SrcFilename) And (Replace Or Not(File.Exists(DestDir, DestFilename))) Then
New = File.Combine(DestDir, DestFilename)
Old = File.Combine(SrcDir, SrcFilename)
If Not(New = Old) Then
NewObj = R.CreateObject2("java.io.File", Array As Object(New),Array As String("java.lang.String"))
R.Target = R.CreateObject2("java.io.File", Array As Object(Old),Array As String("java.lang.String"))
Return R.RunMethod4("renameTo", Array As Object(NewObj),Array As String("java.io.File"))
End If
End If
Return False
End Sub