统计,复制/移动文件的日期 [英] Count, Copy/Move files on from date to date

查看:53
本文介绍了统计,复制/移动文件的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,请帮助创建项目,将文件(带计数)从1个目录复制或移动到另一个目录,我有一个包含7000多个文件的Archive文件夹,我必须移动/复制(带计数)的基于Datetimepicker1到Datetimepicker2的文件,现在下面是我用来移动文件的代码

Hi, kindly help on creation of project on copying or moving files(with count) from 1 directory to another, I am having a Archive folder which has more than 7000 files, i have to move/copy (with count) the files based on Datetimepicker1 to Datetimepicker2, right now below is the code which i am using to move the files

DirectoryInfo source = new DirectoryInfo(textbox1.Text);
DirectoryInfo destination = new DirectoryInfo(textbox2.Text);
foreach (FileInfo file in source.GetFiles("*." + txtExtensions.Text))
{
   file.MoveTo(Path.Combine(destination.FullName, file.Name));
}



急切地等待



waiting eagerly

推荐答案

将代码更改为以下内容:
Change your code to the following :
...
if(file.LastWriteTime > datetimepicker1.Value && file.LastWriteTime < datetimepicker2.value)
   file.MoveTo(...);
...


这篇关于统计,复制/移动文件的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆