Results 1 to 2 of 2

Thread: file rename error help.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    3

    Unhappy file rename error help.....

    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)



  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    sorry, cant help but just a suggestion: if you want people to read your post, or at least if you dont wanna give them a hard time reading it, enclose your code in the [vbcode] and [/vbcode] tags
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width