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-08-01 10:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Please teach me how to find files that were created N days ago in a directory and delete them? View 13,749 Replies 2
Original Poster Posted 2018-06-20 13:40 ·  中国 广东 深圳 电信
初级用户
Credits 60
Posts 20
Joined 2016-03-30 21:10
10-year member
UID 181540
Gender Male
Status Offline
There is a folder A under drive D. There are 30 folders in A, named 1, 2, 3... 30 respectively. In each of these 30 folders, there are respectively 30 folders, also named 1, 2, 3... 30. Now I need to search for files that are N days old in the directories (such as A:\1\1, A:\1\30, A:\30\30) and delete them. How to do it?

The command forfiles /p "D:\A\1\30\" /d -N /c "cmd /c echo deleting @file ... && del /f @path" can delete files that are N days old, but I need to manually change 1\30 (the names of the two subsequent directories), which is too cumbersome. How to operate?
Floor 2 Posted 2018-12-11 05:20 ·  中国 山东 济南 联通
高级用户
★★★
Credits 959
Posts 474
Joined 2007-10-25 10:40
18-year member
UID 100716
Gender Male
Status Offline
You download an XXCOPY. The exclusion date code of this software is simple
Floor 3 Posted 2018-12-11 05:23 ·  中国 山东 济南 联通
高级用户
★★★
Credits 959
Posts 474
Joined 2007-10-25 10:40
18-year member
UID 100716
Gender Male
Status Offline
Originally posted by ydfan8888 at 2018-6-20 01:40 PM:
There is a folder A under drive D. There are 30 folders in A, named 1, 2, 3...30 respectively. In these 30 folders, each folder contains 30 folders respectively, and the names are...

For example: xxcopy /db#2/rs/s/yy D:\A, exclude files within 2 days, and delete others
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
zzz19760225 +2 2018-12-11 09:11
Forum Jump: