|
-
Jul 6th, 2007, 10:31 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [02/03] Rename file successful?
Hello,
I found a function called Rename, just simply Rename, that renames a file. It works, but is it bad to use that? Usually that seems to be the case with functions that aren't part of a namespace. Also, the user tries to rename a file to "////a//aa//" it will rename it to "aaa". I was hoping to have it do a literal renaming, which would break in that case, which I would handle.
So, does anyone know of a better way to do renaming in 2003? The examples I found were in 2005.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Jul 6th, 2007, 10:41 AM
#2
Frenzied Member
Re: [02/03] Rename file successful?
This works in VB2005:
My.Computer.FileSystem.RenameFile("C:\OldFilename.txt", "NewFilename.txt")
Not sure if it works in 2003.
-
Jul 6th, 2007, 10:49 AM
#3
Re: [02/03] Rename file successful?
 Originally Posted by nbrege
This works in VB2005:
My.Computer.FileSystem.RenameFile("C:\OldFilename.txt", "NewFilename.txt")
Not sure if it works in 2003.
That wont work in 2003, the My namespace doesnt exist.
-
Jul 6th, 2007, 10:50 AM
#4
Thread Starter
Fanatic Member
Re: [02/03] Rename file successful?
That is what I found in the 2005 posts. Unfortunately, there is no My namespace in 2003.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Jul 6th, 2007, 11:35 AM
#5
Lively Member
Re: [02/03] Rename file successful?
Possibly, you could move, not rename the files. They do similar things.
IO.File.Move(oldFileName, newFileName) may work
-
Jul 6th, 2007, 11:41 AM
#6
Thread Starter
Fanatic Member
Re: [02/03] Rename file successful?
I think that will work computafreak. I was using copy and delete, and I thought about using move, but then I came across rename. Anyway, I got caught up in other problems with renaming and forgot about trying Move. Thanks.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|