Click here to Skip to main content
16,017,448 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a method to rename a file in c sharp?
Posted

You could use File.Move
C#
File.Move(Path.Combine("FilePath", "OldFileName"), Path.Combine("FilePath", "NewFileName"));
 
Share this answer
 
It might be helpful,

File Rename[^]

:)
 
Share this answer
 
Use <a href="http://msdn.microsoft.com/en-us/library/system.io.file.move.aspx">System.IO.File.Move</a>[<a href="http://msdn.microsoft.com/en-us/library/system.io.file.move.aspx" target="_blank" title="New Window">^</a>]

If source and destination is having same directory, then file will be renamed, otherwise moved to destination.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900