public static Boolean CopyFolder(string existingDocPath, string uploadDocPath)
{
bool isResult = false;
try
{
string _targetPath = Convert.ToString(Config.Get("UploadDocPath"));
DirectoryInfo dir1 = new DirectoryInfo(_targetPath + existingDocPath);
if (Directory.Exists(_targetPath + existingDocPath) && Directory.Exists(_targetPath + uploadDocPath))
{
FileInfo[] Folder1Files = dir1.GetFiles();
if (Folder1Files.Length > 0)
{
foreach (FileInfo aFile in Folder1Files)
{
if (!File.Exists(_targetPath + uploadDocPath + "\\" + aFile.Name))
{
aFile.CopyTo(_targetPath + uploadDocPath + "\\" + aFile.Name);
}
}
}
isResult = true;
}
else
{
isResult = false;
}
}
catch (BaseException ex)
{
logger.LogError("Library.Functions.CopyFolder(): Exception: " + ex.ToString());
}
return isResult;
}
{
bool isResult = false;
try
{
string _targetPath = Convert.ToString(Config.Get("UploadDocPath"));
DirectoryInfo dir1 = new DirectoryInfo(_targetPath + existingDocPath);
if (Directory.Exists(_targetPath + existingDocPath) && Directory.Exists(_targetPath + uploadDocPath))
{
FileInfo[] Folder1Files = dir1.GetFiles();
if (Folder1Files.Length > 0)
{
foreach (FileInfo aFile in Folder1Files)
{
if (!File.Exists(_targetPath + uploadDocPath + "\\" + aFile.Name))
{
aFile.CopyTo(_targetPath + uploadDocPath + "\\" + aFile.Name);
}
}
}
isResult = true;
}
else
{
isResult = false;
}
}
catch (BaseException ex)
{
logger.LogError("Library.Functions.CopyFolder(): Exception: " + ex.ToString());
}
return isResult;
}
No comments:
Post a Comment