China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-22 21:12
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » (Closed) How to delete files older than N days in the DOS command line under WINDOWS DigestI View 27,151 Replies 39
Floor 31 Posted 2007-12-10 23:47 ·  中国 湖北 武汉 电信
社区乞丐
Credits -52
Posts 13
Joined 2007-04-08 02:18
19-year member
UID 84332
Gender Male
Status Offline
This is really awesome, to be able to write something like this.
Looks like I really came to the right place. Truly amazing.
Floor 32 Posted 2007-12-11 02:35 ·  中国 广东 珠海 香洲区 电信
新手上路
Credits 10
Posts 5
Joined 2007-12-11 01:55
18-year member
UID 105281
Gender Male
Status Offline
You can first use set to set the date format.

Originally posted by ribood at 2007-10-10 07:24 PM:
A newbie asking: if the OS regional setting is English and date displays as 10/10/2007 wed, how should the batch file be written??
Floor 33 Posted 2007-12-11 20:58 ·  中国 江苏 苏州 移动
初级用户
Credits 72
Posts 35
Joined 2006-11-13 01:26
19-year member
UID 70380
Gender Male
Status Offline
Doesn't Windows 03 server have forfiles?
That saves all this trouble
Floor 34 Posted 2008-02-03 01:27 ·  中国 四川 成都 电信
初级用户
★★
Credits 110
Posts 50
Joined 2008-01-18 15:02
18-year member
UID 108931
Gender Male
Status Offline
DirT.com and GetInfo.com can be downloaded from http://www.13886.com/soft//,


This address is already invalid, right? How do you get these two parameters?
Floor 35 Posted 2008-07-16 13:58 ·  中国 上海 腾讯云
初级用户
Credits 64
Posts 37
Joined 2007-03-14 03:38
19-year member
UID 81659
Gender Male
Status Offline
Originally posted by aspirer at 2007-12-11 08:58 PM:
Doesn't Windows 03 server have forfiles?
That saves all this trouble


It can't be used under 2000!


DirT.com and GetInfo.com

Testing showed they also do not work properly under 2000!!!!

[ Last edited by yuehong on 2008-10-21 at 21:09 ]
Floor 36 Posted 2009-07-28 06:06 ·  中国 广东 东莞 联通
新手上路
Credits 1
Posts 1
Joined 2009-07-27 08:52
16-year member
UID 149449
Gender Male
Status Offline
New here, and I don't understand quite a lot of this yet. Need to study more, thanks!
Floor 37 Posted 2009-08-12 23:15 ·  中国 浙江 舟山 电信
初级用户
Credits 69
Posts 24
Joined 2006-10-19 05:18
19-year member
UID 66725
Status Offline
Amazing, great thread
Floor 38 Posted 2009-10-22 12:23 ·  中国 广东 深圳 电信
初级用户
Credits 40
Posts 23
Joined 2009-10-15 21:49
16-year member
UID 153140
Gender Male
Status Offline
Originally posted by yuehong at 2008-7-16 13:58:


It can't be used under 2000!


DirT.com and GetInfo.com

Testing showed they also do not work properly under 2000!!!!

[ Last edited by yuehong on 2008-10-21 at 21:09 ]


forfiles from 2003 can be copied directly to 2000 or xp and it will work.. hehe
Floor 39 Posted 2009-10-22 12:28 ·  中国 广东 深圳 电信
初级用户
Credits 40
Posts 23
Joined 2009-10-15 21:49
16-year member
UID 153140
Gender Male
Status Offline
Originally posted by Climbing at 2005-8-25 17:38:
I tried it, and this command is helpful for solving the OP's problem:

for /f "tokens=*" %f in ('dir /b/s' do @if %~tf LSS 2005-08-17 echo %~tf %f

Testing shows that the time returned by the %~tI expansion is equivalent to the time returned by dir /tw, that is, the last modified time, hehe

What if you want to limit it to files created n days ago, or files not accessed for n days (used )?

The problem may be a bit more complicated~~
Floor 40 Posted 2010-05-20 16:35 ·  中国 安徽 合肥 联通
新手上路
Credits 1
Posts 1
Joined 2010-05-19 09:51
16-year member
UID 167161
Gender Male
Status Offline
Keep it up. If only I could reach this level someday too!

Taking this first!!!!
Forum Jump: