C # the program will always generate bin and obj folders. To reduce the size of the source code, it is necessary to delete these two folders, so I want to delete them using a batch file.
The following is the batch processing code:
@ Echo off
Set nowPath = % cd %
Cd
Cd % nowPath %
: Delete specify file (*. pdb, *. vshost .*)
For/r % nowPath % I in (*. pdb, *. vshost. *) do (del % I)
: Delete specify folder (obj, bin)
For/r % nowPath % I in (obj, bin) do (if exist % I RD/s/q % I)
Echo OK
Pause
Note:
1. In batch processing, two half-width colon prefixes indicate comment out this line
2. Copy the above Code to notepad and name it a file with the suffix bat, such as clear. bat.
3. clear. bat should be placed in the directory (or upper-level directory) for deletion)
IF you only need to delete a file, you can do (if exist % I RD/s/q % I) for/r % nowPath % I in (obj, bin) remove this sentence, and then set for/r % nowPath % I in (*. pdb ,*. vshost. (*. pdb ,*. vshost. *) change to the file to be deleted.