![]() |
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-12 07:57 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Delete non-empty folders under the specified directory |
| Printable Version 1,473 / 2 |
| Floor1 zidian | Posted 2009-07-31 12:16 |
| 新手上路 Posts 2 Credits 2 | |
|
I have made a file upload system. When employees use it, the system will prompt them to first enter their employee number and then click "Submit". (At this time, a folder named after the employee's work number will be generated in a directory called "scan" on my server A.) Then the employee can enter the next interface to select some files on the local computer and then click "Upload".
I will run a batch script on my server A. It will first check if there are folders in the "scan" directory. If there are, it will copy this folder and the files inside it to a file server B accessible to all employees, and then the batch script will immediately delete the folder in the "scan" directory. (That is, to achieve the purpose of cutting.) Now the problem is that when the batch script on server A is performing the copy + delete operation, an employee is preparing to upload a file. The folder named after his employee number has been generated in "scan", but he hasn't started uploading the file yet! At this time, the deletion action on server A has also deleted this empty folder, so he fails when uploading the file. So my batch script should be modified. I hope to only delete the non-empty folders in the "D:\scan\" directory. Please help me figure out a way. Thanks a lot! |
|
| Floor2 tireless | Posted 2009-07-31 13:02 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
Folders with files inside will be deleted:
--------------- Folders with files or subfolders inside will be deleted: [ Last edited by tireless on 2009-7-31 at 14:18 ] |
|
| Floor3 zidian | Posted 2009-08-03 23:42 |
| 新手上路 Posts 2 Credits 2 | |
|
The method on the 2nd floor seems feasible. I'll give you points first. Thanks for your support!
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |