仅搜索更改的目录 [英] Search Only Changed Directory(s)

查看:59
本文介绍了仅搜索更改的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行该批处理,到目前为止效果很好.唯一的缺点是它每次都会搜索整个硬盘.我想使其更快.有没有一种方法可以在运行时仅检查自上次运行以来已更改的目录.我想这意味着它第一次运行时将检查所有内容,除非它检查今天已更改的目录.只是把想法扔在那里...任何帮助表示赞赏.谢谢

I''m running this batch that works pretty good so far. The only downside is that it searches the entire hard drive everytime. I want to make it quicker. Is there a way that when it runs that it only checks the directory(s) that have changed since the last time it ran. I guess this means that the first time it runs it will check everything, unless it checks for directory(s) that changed today. Just throwing thoughts out there...any help is appreciated. Thanks

@echo off 
setlocal 
for /f "delims=" %%b in ("%time%") do set "tm=%%b" 
set "tm=%tm:~0,5%" 
set "tm=%tm: =0%" 


for /f "tokens=2" %%b in ("%date%") do set "d8=%%b" 


set filespec=\*.zip \*.txt \*.jpg 
for /f "delims=" %%a in (' 
dir %filespec% /a:-d /o:n /b /s') do ( 
if "%%~ta"=="%d8% %tm%" ( 
del "%%a"
) 
)

推荐答案

不幸的是,批处理文件没有内存.

对于您的用例,最好以更高级别的语言来完成,以便您可以存储目录的信息.
Unfortunately batch files have no memory.

For your use case it is better you did this in a higher level language which you can store information for your directories.


这篇关于仅搜索更改的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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