Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / October 2004

Tip: Looking for answers? Try searching our database.

Renaming a file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard L Rosenheim - 27 Oct 2004 07:06 GMT
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
CT - 27 Oct 2004 07:44 GMT
Richard,

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

Signature

Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105

> Correct me if I'm wrong...
>
[quoted text clipped - 8 lines]
>
> Richard
Shankara Narayanan - 27 Oct 2004 07:54 GMT
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 <richard@rlr.com> wrote in message
<OvvdUs#uEHA.3376@TK2MSFTNGP12.phx.gbl>

> Correct me if I'm wrong...
>
[quoted text clipped - 6 lines]
>
> Richard
Nishith Pathak - 27 Oct 2004 10:35 GMT
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

> Yes -
> Afraid so.  You have to move the file for renaming.  I have also
[quoted text clipped - 17 lines]
> >
> > Richard
Jon Skeet [C# MVP] - 27 Oct 2004 11:24 GMT
> 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.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Chris Dunaway - 27 Oct 2004 15:13 GMT
> 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.

Signature

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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.