C # tips: How to quickly delete the bin and obj folders

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.