Example: I have the file Path for input file "C:/Documents/Sample.txt" now I want to use this path to get the File and then Save it to a Different Location with same file name like "E:/Downloads/Sample.txt".
Answer:
true use for- if file already exists in destination path then it overwrites.
Answer:
string sourcePath = @"C:\Documents\Sample.txt"; string fileName = System.IO.Path.GetFileName(sourcePath); string destinationPath = System.IO.Path.Combine (@"E:\Downloads", fileName);
// will result in E:\Downloads\Sample.txtSystem.IO.File.Copy(sourcePath,destinationPath,true); eg: Path: "c:\\sampletest.jpg"
true use for- if file already exists in destination path then it overwrites.
No comments:
Post a Comment