Change fileNames using C# code
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
gallian99
Junior Poster in Training
82 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
I think there no method to do so, you can use DOS commands and call\send parameters to them from C# application.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7
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.
gallian99
Junior Poster in Training
82 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
With pleasure ProcessStartInfo commandPromptProcess = new ProcessStartInfo("cmd.exe"); Find out how to make use of this.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7
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.
gallian99
Junior Poster in Training
82 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7
I guess File.Move(old,new) was too much to look for?
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 1
Thanks, I was just looking for an efficient and quick way.
I guess File.Move(old,new) was too much to look for?
gallian99
Junior Poster in Training
82 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Please mark the thread as solved.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 1
Question Answered as of 4 Years Ago by
Ramy Mahrous
and
LizR How can I get the file extension?
Please mark the thread as solved.
gallian99
Junior Poster in Training
82 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
You can use string class to fetch the extension from its name or you can use FileInfo class.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Skill Endorsements: 7