Public Function renameFile(ByVal where As String)
Dim dy As DirectoryInfo
dy = New DirectoryInfo(where)
Dim totalFile = dy.GetFileSystemInfos.Length
Dim file As Object
Dim folder As Object
Dim i As Integer
Dim extention As String
Dim newFileName As String
file = CreateObject("scripting.filesystemobject")
For i = 1 To totalFile
If file.folderexists(where) Then
folder = file.getFolder(where)
For Each file In folder.files
extention = Split(file.name, ".")(1)
newFileName = i & "." & extention
Dim oldFileName As String = file.name

Rename(where & oldFileName, where & newFileName)
Rename(where & "large/" & oldFileName, where & "large/" & newFileName)
i = i + 1
Next
End If
Next
End Function
-------------------------------------------------------------------------------
i got this following error........i have two rename() the first one is working fine without error....but everytime run on the second rename() i got the error message....
why?...... anyone can help me please?
super thx....!
-------------------------------------------------------------------------------
Procedure call or argument is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Procedure call or argument is not valid.

Source Error:

Line 412: Rename(where & "large/" & oldFileName, where & "large/" & newFileName)