How to change folder or file name using C# ?

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2009
Posts: 2
Reputation: BullzEyezz is an unknown quantity at this point 
Solved Threads: 0
BullzEyezz BullzEyezz is offline Offline
Newbie Poster

How to change folder or file name using C# ?

 
0
  #1
Sep 18th, 2009
I'm making a project that gets folder and file names in a specific path and I want to edit the folder or file names? (e.g: folder name is X.Men.DVDrip I want to change it to X Men DVDrip)
I have the path of the folder, but I dont know how to change the file name.

Can anyone help me with this issue ?
(am using VS C# 2008)

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: How to change folder or file name using C# ?

 
0
  #2
Sep 18th, 2009
File | You may use Move method in System.IO like that
  1. System.IO.File.Move(@"C:\old.txt", @"C:\new.txt"); //it renames the file old to new.txt

Folder | the same
  1. System.IO.Directory.Move(@"C:\oldfolder", @"C:\newfolder");
Last edited by Ramy Mahrous; Sep 18th, 2009 at 8:39 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 2
Reputation: BullzEyezz is an unknown quantity at this point 
Solved Threads: 0
BullzEyezz BullzEyezz is offline Offline
Newbie Poster

Re: How to change folder or file name using C# ?

 
0
  #3
Sep 18th, 2009
Thanks a lot Ramy. I'll give it a try
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC