![]() |
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-08-02 19:14 |
48,038 topics / 350,123 posts / today 1 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Extract and delete the specified date-named files from the text |
| Printable Version 1,744 / 6 |
| Floor1 gene771771 | Posted 2006-12-15 00:53 |
| 初级用户 Posts 77 Credits 105 From 重庆 | |
|
There is a document a.txt with content and format as follows:
This is actually a list, with dates at the front and file names at the back .... 2005-12-02 43324 2005-12-03 232323 2005-12-04 rjjjdj 2005-12-05 fhsh 2005-12-06 sdhsh .... 2005-12-12 2005-12-13 fhhshs 2005-12-14 2005-12-15 fdhfg .... Purpose: Use batch processing to extract the file names in a.txt and delete the files created within a specified period of time. I want to delete the files created from December 3, 2006 to December 15, 2006. Is there a good method? |
|
| Floor2 namejm | Posted 2006-12-15 01:54 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
The following is the demonstration code. Replace the echo statement with the del statement when you are satisfied:
|
|
| Floor3 redtek | Posted 2006-12-15 02:34 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
Another alternative method to delete files between December 3, 2006 and December 15, 2006: )
(Note: The following command deletes files from December 3, 2006 to December 15, 2006 inclusive |
|
| Floor4 redtek | Posted 2006-12-15 02:34 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
Using the characteristics of the WinRAR compression tool, after execution, the deleted file is equivalent to being moved into the compressed package. If you don't want it anymore, just delete the compressed package.RAR. If you mistakenly delete it, you can also extract and recover it.
The above instruction has been tested and passed. The following gives the parameter explanation of WinRAR. RAR.EXE /? has more detailed help: ) (Note: I directly copied the rar.exe in the WinRAR compression tool directory to the windows directory for convenient calling, and I'm too lazy to modify the environment PATH information: ) |
|
| Floor5 lh82102849 | Posted 2006-12-15 03:03 |
| 初级用户 Posts 11 Credits 24 | |
|
Learned, so it can be like this. Thanks for sharing
|
|
| Floor6 lxmxn | Posted 2006-12-15 04:32 |
| 版主 Posts 4,938 Credits 11,386 | |
|
It seems that Brother Redtek has a lot of research on various command-line tools, I've learned a lot. Plus points~ |
|
| Floor7 vkill | Posted 2006-12-16 10:03 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
Well, it can also be achieved with winrar~ Learned it
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |