批处理过程从一个文件夹移到具有YYYYMMDD格式的日期文件到另一个文件夹 [英] Batch process to move file having Date in YYYYMMDD format from one folder to another folder

查看:224
本文介绍了批处理过程从一个文件夹移到具有YYYYMMDD格式的日期文件到另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能移动的文件没有考虑日期考虑使用以下命令:通过批量处理移动

I am able to move the files without taking date into consideration with the command: MOVE through Batch process.

move C:\DESTINATION\FILE.txt C:\DESTINATION\

但正如我的文件中包含日期格式,我需要根据当前日期移动的文件。

But as my file contains date format and I need to move the files based on current date.

推荐答案

您可以获取当前日期与 WMIC

You can get the current date with wmic:

for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate %x
set MyDate=%MyDate:~0,8%

,然后只需移动:

and then just move them:

move %MyDate%.txt destination

这篇关于批处理过程从一个文件夹移到具有YYYYMMDD格式的日期文件到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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