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.

Recommended Answers

All 2 Replies

File | You may use Move method in System.IO like that

System.IO.File.Move(@"C:\old.txt", @"C:\new.txt"); //it renames the file old to new.txt

Folder | the same

System.IO.Directory.Move(@"C:\oldfolder", @"C:\newfolder");

Thanks a lot Ramy. I'll give it a try

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.