You may have encountered such a situation:
You inadvertently extracted a batch of files (assuming all are files, no subdirectories) to the wrong directory (assuming C:\), and then extracted them again to the correct directory (D:\PROGRAM), you need to delete those previous files, but there are too many, and it's tedious to delete them one by one..
So how to solve it with a single line of DOS batch processing?
Also, if you increase the difficulty, like this:
Suppose you forgot where you originally extracted the files to (the wrong directory), (only knowing it's on the C drive), then how to write it?
(Here, it is especially necessary to make sure that there are no important files with the same file name elsewhere, or for safety, narrow the directory range to a useless folder for testing... For example, create a directory AB in C:\, then create a CD directory in AB, and then copy the files from D:\PROGRAM into it, and take C:\AB\CD as the test range...)
Also, what if the extracted files also have subdirectories? (One line is definitely not enough)
You inadvertently extracted a batch of files (assuming all are files, no subdirectories) to the wrong directory (assuming C:\), and then extracted them again to the correct directory (D:\PROGRAM), you need to delete those previous files, but there are too many, and it's tedious to delete them one by one..
So how to solve it with a single line of DOS batch processing?
Also, if you increase the difficulty, like this:
Suppose you forgot where you originally extracted the files to (the wrong directory), (only knowing it's on the C drive), then how to write it?
(Here, it is especially necessary to make sure that there are no important files with the same file name elsewhere, or for safety, narrow the directory range to a useless folder for testing... For example, create a directory AB in C:\, then create a CD directory in AB, and then copy the files from D:\PROGRAM into it, and take C:\AB\CD as the test range...)
Also, what if the extracted files also have subdirectories? (One line is definitely not enough)




do del %drive%:\%%i /q /s