cloudflight
2024-06-10 45849075b72187ab882e9f5f9d12d5a4b9748f9e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)
            {
                
            }
            
        }
    }
}