批处理脚本从一个文件夹到其他移动最早的文件 [英] Batch script to move oldest file from one folder to other

查看:112
本文介绍了批处理脚本从一个文件夹到其他移动最早的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 c进行一些文件:\\测试文件夹中。我想最老的修改后的文件(文件,该文件被修改第一个)移动到另一个位置。我是很新的脚本。
你能帮我这个问题?


解决方案

 关闭@echo
CD C:\\测试
FOR / Fdelims =%%一个在('DIR / B / A:-D / O:D / T:W')做(
   移动%%一个C:\\另一个\\位置
   转到继续

:继续

I have a number of files in my c:\Test folder. I want to move the oldest modified file (file which was modified first) to another location. I am very new to scripting. Could you help me with this issue?

解决方案

@echo off
cd c:\Test
for /F "delims=" %%a in ('dir /B /A:-D /O:D /T:W') do (
   move "%%a" C:\Another\Location
   goto continue
)
:continue

这篇关于批处理脚本从一个文件夹到其他移动最早的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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