![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-23 12:21 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » Please teach me how to find files that were created N days ago in a directory and delete them? |
| Printable Version 13,952 / 2 |
| Floor1 ydfan8888 | Posted 2018-06-20 13:40 |
| 初级用户 Posts 20 Credits 60 | |
|
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? |
|
| Floor2 5872169 | Posted 2018-12-11 05:20 |
| 高级用户 Posts 474 Credits 959 | |
|
You download an XXCOPY. The exclusion date code of this software is simple
|
|
| Floor3 5872169 | Posted 2018-12-11 05:23 |
| 高级用户 Posts 474 Credits 959 | |
Originally posted by ydfan8888 at 2018-6-20 01:40 PM: For example: xxcopy /db#2/rs/s/yy D:\A, exclude files within 2 days, and delete others |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |