Greetings,

How to change a file name using C# code with fixed path to the subject file?

Do I need to copy/create a new file with new name and delete the old one or is there a way to change the name without doing above.

Rds

Recommended Answers

All 10 Replies

I think there no method to do so, you can use DOS commands and call\send parameters to them from C# application.

Can you help me with that?

I think there no method to do so, you can use DOS commands and call\send parameters from them from C# application.

With pleasure ProcessStartInfo commandPromptProcess = new ProcessStartInfo("cmd.exe"); Find out how to make use of this.

Which system file does this ProcessStartInfo belongs to? I mean what do i need to add

using System.ProcessStartInfo? or something else

With pleasure ProcessStartInfo commandPromptProcess = new ProcessStartInfo("cmd.exe"); Find out how to make use of this.

System.Diagnostics

I guess File.Move(old,new) was too much to look for?

Thanks, I was just looking for an efficient and quick way.

I guess File.Move(old,new) was too much to look for?

Please mark the thread as solved.

How can I get the file extension?

Please mark the thread as solved.

You can use string class to fetch the extension from its name or you can use FileInfo class.

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.