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-12 07:03
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Delete and recreate a folder and the files in it View 740 Replies 1
Original Poster Posted 2010-07-08 11:36 ·  中国 广东 东莞 电信
新手上路
Credits 8
Posts 7
Joined 2009-11-19 18:49
16-year member
UID 154995
Gender Male
Status Offline
I want to use a batch file to do something like this:

For example, on drive D there is a folder called “My Documents”

Under this folder there are many files. But they are all EXCEL files. For example, 1月.xls 2月.xls 3月.xls

So I want to use a batch file to delete this folder and everything under it. After deleting it, automatically create a folder again. The folder name should be the same as before, “My Documents” After the folder is created, also recreate the files in the folder the same as before deletion, such as 1月.xls 2月.xls 3月.xls (of course the recreated ones are empty files. What I really mean is to use a batch file to delete them and then recreate the same folder and files as before. Please help me with this. This job has to be done every month. Doing them one by one is too slow.

After the folder is created, finally display a message: " File deletion complete. The new folder and files have been created successfully" After this message appears for 15 seconds, the dialog box should disappear automatically.
Floor 2 Posted 2010-07-08 16:43 ·  中国 江苏 扬州 电信
高级用户
★★★
Credits 620
Posts 329
Joined 2007-12-05 15:34
18-year member
UID 104754
Gender Male
Status Offline
There's no need to use BAT

For what the OP wants, a RAR archive is enough,

Pack them into one archive, and when needed just extract it.................
Forum Jump: