photo © 1918 National Library of Scotland | more info (via: Wylio)The Problem: You need to copy a file from one location on the server to another and cannot remember how.
The Cause: It is too short and simple, and easily forgotten
The Solution: Just use the following code:
public static void CopyAndRenameFile(string OldPath, string OldFileName, string NewPath, string NewFileName)
{
if (File.Exists(OldPath + OldFileName))
{
File.Copy(OldPath + OldFileName, NewPath + NewFileName, true);
}
}
That’s it!
This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog
|
Written By Steve French |
The problem is how to fix not how to copy.
So, if we copied a file and we created a HashMap for this file (using MD5 or CRC32)before and after copying, so that we can check after copying that the file has been fully copied without any corruption.
let’s assume that we find a corruption Pakete in this copied file.
the question is: except of re-copying the file, is there any thing we can do to only fix the corrupted Pakete using MD5 or CRC32 ??
Thanks in Advanced,