I'm writing a code in C# and this is what i want to do:
I want to change the extension of a file from ".txt" to ".jpg" . Bu this "txt" can be in any directory (so its a unknown directory). This it he path "C:\Users\username\Desktop\Convert" . So inside the convert folder there will be many other folders inside which there will be a ".txt" file (only one "txt" file will exist.). So the code should automatically change the extension of ".txt" file to ".jpg" . Please guide me
VulpesPosted Oct 16, 2014, 3:48 PM
Please note that the code will search the Convert folder itself, all its sub-folders and any nested folders thereof for the .txt file.
As a safety measure it will only rename the file if there's exactly one .txt file (and tell you what's been renamed) as code such as this can easily mess up your file system:
Console.ReadKey();
Mohan DPosted Oct 16, 2014, 11:24 PM
This works perfectly as intended !! Thanks a million for the help !!