Common.MoveFile(FilewithPath, LocalFilePath + FileName) public static bool MoveFile(string sourcefile, string destinationfile) { try { Common.WriteLogService ("File Movement Process Started", "MoveFile()", false); if (File.Exists(sourcefile)) { if (File.Exists(destinationfile)) //delete destination // file if it already exists to avoid exception //of file already exists { File.Delete(destinationfile); } File.Move(sourcefile, destinationfile); Common.WriteLogService("File:" + sourcefile + " Moved to" + destinationfile, "MoveFile()", false); } Common.WriteLogService("File Movement Process Completed", "MoveFile()", false); } catch (Exception ex) { Common.WriteLogService("File Movement Process failed with Exception: " + ex.Message + Environment.NewLine + " with Inner Exception: " + ex.InnerException + Environment.NewLine + " at Stack Trace: " + ex.StackTrace, "MoveFile()", true); return false; } return true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)