简体   繁体   English

将选定的文件复制到不同的目录

[英]Copying the selected files to a different directory

I have the following command which returns the files that are modified on that day.我有以下命令返回当天修改的文件。

for /F "tokens=2" %i in ('date /t') do dir /T:C | findstr /C:%i /B

I would need to know how to copy these selected file from the current directory to a new directory?我需要知道如何将这些选定的文件从当前目录复制到新目录? Can this be achieved with copy command?这可以通过复制命令来实现吗?

copy for /F "tokens=2" %i in ('date /t') do dir /T:C | findstr /C:%i /B "D:Test\"

No errors and script doesn't work either.没有错误,脚本也不起作用。

Without re-writing any of your existing code to find today's files, you can utilize forfiles无需重写任何现有代码来查找今天的文件,您可以利用forfiles

for /F "tokens=2" %i in ('date /t') do forfiles /D +%i /C "cmd /c copy @path <destination_path>"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM