473,395 Members | 1,532 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,395 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 3573
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.