473,320 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Renaming a file

Correct me if I'm wrong...

It appears that out of the 1800+ classes in the .Net framework, there isn't
a file rename method (discounting the rename function in the vb namespace).
And that the solution is to move the file to the same directory with a
different destination name.

Does that correctly summarize it?

Richard
Nov 22 '05 #1
5 3572
CT
Richard,

I've always done it like that, which is pretty straightforward. However, if
anyone knows a better/different way...

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:Ov****************@TK2MSFTNGP12.phx.gbl...
Correct me if I'm wrong...

It appears that out of the 1800+ classes in the .Net framework, there
isn't
a file rename method (discounting the rename function in the vb
namespace).
And that the solution is to move the file to the same directory with a
different destination name.

Does that correctly summarize it?

Richard

Nov 22 '05 #2
Yes -
Afraid so. You have to move the file for renaming. I have also
faced same prob.
Shankar
10/27/2004 11:36:18 AM
Richard L Rosenheim <ri*****@rlr.com> wrote in message
<Ov**************@TK2MSFTNGP12.phx.gbl>
Correct me if I'm wrong...

It appears that out of the 1800+ classes in the .Net framework, there isn't a file rename method (discounting the rename function in the vb namespace). And that the solution is to move the file to the same directory with a different destination name.

Does that correctly summarize it?

Richard

Nov 22 '05 #3
Dear all,

There is Rename function available in Microsoft.VisualBasic namespace and is
only available to VB.Net and not to other language like C#. seems strange
when i do it. But the best universal and standard solution to rename the file
is to use the File.Move method but in case if you r working on VB.NET, you
got the rename function to rename your files.

Nishith

"Shankara Narayanan" wrote:
Yes -
Afraid so. You have to move the file for renaming. I have also
faced same prob.
Shankar
10/27/2004 11:36:18 AM
Richard L Rosenheim <ri*****@rlr.com> wrote in message
<Ov**************@TK2MSFTNGP12.phx.gbl>
Correct me if I'm wrong...

It appears that out of the 1800+ classes in the .Net framework,

there isn't
a file rename method (discounting the rename function in the vb

namespace).
And that the solution is to move the file to the same directory

with a
different destination name.

Does that correctly summarize it?

Richard

Nov 22 '05 #4
Nishith Pathak <Ni***********@discussions.microsoft.com> wrote:
There is Rename function available in Microsoft.VisualBasic namespace and is
only available to VB.Net and not to other language like C#.


No, you can use the Microsoft.VisualBasic namespace from C#. The Rename
method is a static one in the FileSystem class.

I can't see that it's likely to have a significantly different effect
to using File.Move though.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #5
On Wed, 27 Oct 2004 12:24:10 +0530, Shankara Narayanan wrote:
Yes -
Afraid so. You have to move the file for renaming. I have also
faced same prob.


Why is that a problem? It works as intended. When calling the Move method
to the same folder, I believe it just changes the name and does not
actually "move" anything.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: peter | last post by:
Hello all, Recently I've started to refactor my code ...(I'm using python 2.3.4) I tried to add extra functionality to old functions non-intrusively. When I used a construct, which involves...
5
by: Richard L Rosenheim | last post by:
Correct me if I'm wrong... It appears that out of the 1800+ classes in the .Net framework, there isn't a file rename method (discounting the rename function in the vb namespace). And that the...
0
by: MikeY | last post by:
Hopefully someone can help, I have a listview box where I display my desired files. I single click on the desired file to be renamed and I rename it with a new name. My problem arises when the...
0
by: Andy | last post by:
Hello: I am using System.Web.Mail.MailMessage. Currently: when I am attaching a file to the object, I am renaming the file using the FileInfo.Copy method and attaching the new file to the...
2
by: cloudx | last post by:
Hi there, it is driving me crazy. Aftering renaming app.config the following code I always get null on myApp. It works if I keep the name app.config. Why? string myApp =...
1
by: MikeY | last post by:
Hopefully someone can help, I have a listview box where I display my desired files. I single click on the desired file to be renamed and I rename it with a new name. My problem arises when the...
1
by: Jason B | last post by:
Hello, I have been trying to figure out how to rename my IIS directories and still have the project be able to run through VS. I have renamed the directories listed in the csproj.webinfo file and...
5
by: bulldog8 | last post by:
I've read numerous posts and have tried multiple approaches that I found, but just cannot get a file renamed. I am using VB.Net 2002 ... Here is what I have tried: 1) Code common to all...
1
by: rush81 | last post by:
i'm trying to create an ssis package for renaming and moving the file. It gives error at the file system task: Error: An error occurred with the following error message: "Could not find file...
3
by: NIKHILUNNIKRISHNAN | last post by:
Experts, I am getting file not found error while enabling the Renaming option of dotfuscator 4.4 Professional. Can any who has experience in this field help me out ? with advance thanks,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.