
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Program to Rename a File
Use the Move method to rename a file.
Let’s say the file name is −
D:\tom.txt
Now, to update it to the following, use the Move() method.
D:\tim.txt
Let us see the complete code.
Example
using System; using System.IO; public class Demo { public static void Main() { File.Move(@"D:\tom.txt", @"D:\tim.txt"); Console.WriteLine("File moved successfully!"); } }
Advertisements