批处理文件可根据修改日期复制文件 [英] Batch file to copy a file based on date modified

查看:690
本文介绍了批处理文件可根据修改日期复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件夹:C:\ data \ PRODDB \ dir

Folder : C:\data\PRODDB\dir

在上面的文件夹中,每天早上创建文件.我想创建一个批处理脚本,该脚本根据日期检查/识别该文件夹中是否有最新文件,并将其复制到其他位置(d:\ test).

In the above folder files get created daily in the morning .I want to create a batch script which checks/identifies that folder for the latest file based on date and copy to other location ( d:\test).

例如:文件创建为backup_110513.DMP,2013年11月5日

eg: file created as backup_110513.DMP 11/05/2013

我们将使用备份软件安排备份作业以备份文件夹(d:\ test)中的文件,并且从d:\ folder备份该特定文件后,需要创建另一个脚本来清空该文件夹d:\ test.

We will use a backup software to schedule a backup job to backup the files in the folder(d:\test) and after that particular file gets backed up from d:\folder, need to create another script which empties the folder d:\test.

谢谢.

推荐答案

这将复制文件的修改日期为今天的

This will do the copy part of the files with modification date of today

forfiles /P "c:\data\PRODDB\dir" /M *.DMP /D +0 /C "cmd /c copy @path d:\test"

这篇关于批处理文件可根据修改日期复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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