using iWare_SCADA_BusinessLogical.Utils;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
|
namespace iWare_SCADA_FormTest
|
{
|
public partial class Form1 : Form
|
{
|
public Form1()
|
{
|
InitializeComponent();
|
}
|
|
private void button1_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
string path = ConfigHelper.GetConfigString("OP80QualityData_Test");//OP80的地址
|
|
var newFiles = FileHelper.DetectNewFilesCSV(path, 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1));
|
|
foreach (System.IO.FileInfo file in newFiles)
|
{
|
MessageBox.Show("找到文件:" + file.FullName);
|
var toPath = file.FullName.Replace("CA4GC20TD_Test", "CA4GC20TD_COPY");
|
MessageBox.Show("要移动到:" + file.FullName);
|
File.Move(file.FullName, toPath);//移动
|
}
|
|
MessageBox.Show("成功");
|
}
|
catch (Exception ex)
|
{
|
MessageBox.Show("异常:" + ex.Message);
|
}
|
|
}
|
|
private void button2_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
string path = ConfigHelper.GetConfigString("OP60QualityData_Test");
|
|
var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1));
|
|
foreach (System.IO.FileInfo file in newFiles)
|
{
|
//MessageBox.Show("找到文件:" + file.FullName);
|
var toPath = file.FullName.Replace("Measuring_Data_df_Test", "Measuring_Data_df_Copy");
|
//MessageBox.Show("要移动到:" + file.FullName);
|
File.Move(file.FullName, toPath);//移动
|
}
|
|
MessageBox.Show("成功");
|
}
|
catch (Exception ex)
|
{
|
MessageBox.Show("异常:" + ex.Message);
|
}
|
}
|
|
private void button3_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
string path = ConfigHelper.GetConfigString("OP60QualityData_Zhengshi");
|
|
var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1));
|
|
foreach (System.IO.FileInfo source_doFile in newFiles)
|
{
|
//MessageBox.Show("找到FullName:" + source_doFile.FullName+ ",Name:" + source_doFile.Name);
|
|
//目标文件的完整目录
|
string destFileName = source_doFile.FullName.Replace("Measuring_Data_dfq", "Measuring_Data_df_Copy");
|
string source_file_name = source_doFile.Name.Replace(".dfq", "");//不带扩展名的文件名字
|
destFileName = destFileName.Replace(source_file_name, source_file_name + "_" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
|
File.Copy(source_doFile.FullName, destFileName, true);
|
|
//FileInfo destFile = new FileInfo(destFileName);
|
//MessageBox.Show("新文件找到FullName:" + destFile.FullName + ",Name:" + destFile.Name);
|
}
|
|
MessageBox.Show("成功");
|
}
|
catch (Exception ex)
|
{
|
MessageBox.Show("异常:" + ex.Message);
|
}
|
}
|
}
|
}
|