Search code examples
vb.netiofile-renamefile-copying

Error trying rename a file


Hi community!

I have an application in VB.Net, in the user's computer is located in program files. The users run always the program as an Administrators.

But in some cases; when the program try to rename a file in the program files the program throws the following exception:

The given path's format is not supported. SOURCE = System.Security.Util.StringExpressionSet.CanonicalizePath

Also, happens when I try to copy a file.

The application does the rename or copy automatically and it's the same name for all the users

Example:

Rename(vOld, vNew)
FileCopy(vOld, vNew)

This exception only happen in Win7.

Somebody have an idea what is the reason to some users appear this exception?


Solution

  • All it's my fault!

    -_-'

    I'm trying to rename this path:

    C:\_MyFile.xlsx
    

    To:

    C:\MyFile.xlsx
    

    In my computer all works fine because I have the both files (The users only has the file with the underscore). When the program try to validate it try to rename the file "_C:\MyFile.xlsx" to "C:\MyFile.xlsx"

    The exception don't give much information about my error...