renaming a setup in c#
i have a setpu in c:\3c\install\builds\output\ dir having name setup. i want to rename this setup from a c# file. please tell me how to rename this . 开发者_如何学编程when i am tyring File.Move(c:\3c\install\builds\output\setup,c:\3c\install\builds\Renamesetup\newsetup);
it is giving file not found exception.
Could not find file 'c:\3c\install\builds\output\setup'.
please tell me what is wrong in it .
thanks
File.Move("c:\\3c\\install\\builds\\output\\setup", "c:\\3c\\install\\builds\\Renamesetup\\newsetup");
This assumes that the file "setup" does not have an ".exe" extension. Also, the new file will not have an ".exe" extension.
The folder "Renamesetup" must exist in advance, otherwise you must create it in your code using Directory.CreateDirectory
.
Please note that you have to "quote" the backslashes using "\\" as I've done above. This only works if "setup" is a file!
The path makes it look like setup is a directory. If so you should use
System.IO.Directory.Move
精彩评论