using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace Hydro.CommonBase
|
{
|
public static class FileCopy
|
{
|
public static void Copy(string source, string destination,bool isOverWrite=true)
|
{
|
//ÅжÏÔ´ÎļþÊÇ·ñ´æÔÚ
|
if (!System.IO.File.Exists(source))
|
{
|
return;
|
}
|
//ÅжÏÔ´ÎļþÊÇ·ñΪֻ¶Á,Èç¹ûÊÇÔò¸ü¸ÄΪ·ÇÖ»¶Á
|
System.IO.FileInfo file = new System.IO.FileInfo(source);
|
if (file.IsReadOnly)
|
{
|
file.IsReadOnly = false;
|
}
|
//ÅжÏÄ¿±êÎļþ¼ÐÊÇ·ñ´æÔÚ,²»´æÔÚÔò´´½¨
|
string dir = System.IO.Path.GetDirectoryName(destination);
|
try
|
{
|
System.IO.File.Copy(source, destination, isOverWrite);
|
}catch (Exception ex)
|
{
|
|
}
|
|
}
|
}
|
}
|