Batch Processing-Batch delete SVN flag

Source: Internet
Author: User
Keyit. Focus ();}
// -->

Shell
I wrote a lot, but I have never used batch processing. In short, batch processing is a combination of some DOS commands. Today, I wrote the first batch of processing. Program By the way, I also learned about the commonly used doscommands. To
I always felt that the DOS was outdated and I had never learned it well. I tried it for the first time, but I had a little more knowledge. Program Code As follows:

@ Echo off

: Start
: During the startup process, switch the Directory
Set Pwd = % Cd %
Cd % 1
The echo working directory is: & chdir

: Input
: Gets the input and processes it according to the input.
Set Source =:
Set/P Source = Are you sure you want to know the svn information in the current directory? [Y/n/q]
Set "Source = % Source:" = %"

If "% source %" = "Y" Goto clean
If "% source %" = "Y" Goto clean
If "% source %" = "N" Goto noclean
If "% source %" = "N" Goto noclean
If "% source %" = "Q" Goto end
If "% source %" = "Q" Goto end
Goto Input

: Clean
: Performs cleanup during the main processing process.
@ Echo on
@ For/D/R % C in (. SVN) Do @ if exist % C (RD/S/Q % C & Echo Delete directory % C)
@ Echo off
Echo "SVN information in the current directory has been cleared"
Goto end

: Noclean
: Cancels cleanup during the branching process.
Echo "SVN clear operation canceled"
Goto end

: End
: Exit the program
Cd "% PWD %"
Pause

The following describes the program functions. This program is used to delete the subdirectory named. SVN under the specified directory of the loop, that is, to delete SVN information. You can copy the above Code to the wendows text file and change the suffix to. bat. When used, the current directory is the working directory without parameters, and the first parameter is the working directory without parameters (No parameter verification is performed ). The first code prints the working directory; the second and third sections of the Code cyclically obtain and parse parameters, and turn to the corresponding operation; the fourth section traverses the delete sub-directories; the fifth section cancels the delete operation; and the sixth section exits the program. Related commands: @
Do not print this command Echo on | off
Open | close the display of subsequent commands Set
Set parameters or environment variables Goto
Jump Pause
Pause the program. The page displays "Please press any key to continue ......" There is only one complex command in the program: @ For/D/R % C in (. SVN) Do @ if exist % C (RD/S/Q % C & Echo
Delete directory
% C) For/R
Traverse the current directory cyclically, /D
Specify the directory instead of the file to be traversed. The directory name is. SVN; If exist
Check that the directory does not exist. If yes, delete the directory ( Rd
), And print the deletion information.

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.