- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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!"); } }
- Related Articles
- Java Program to rename a file or directory
- C program to change the file name using rename() function
- How to rename a file using Python?
- What are the steps to rename a file in Git?
- Rename file or directory in Java
- C program to delete a file
- C# Program to get information about a file
- C Program to find size of a File
- C# Program to write an array to a file
- C++ program to print unique words in a file
- C program to remove a line from the file
- Rename function in C/C++
- C# program to get the extension of a file in C#
- C program to copy the contents of one file to another file?
- C# Program to display temporary file names

Advertisements