BAT quickly deletes CVS files and copies the directory structure of recently modified files

BAT quickly deletes CVS files and copies the directory structure of recently modified files

I believe that when you operate a large number of files, you often encounter some situations that are difficult to operate manually.

For example, there is a CVS folder under each folder under the CVS version control. It must be very laborious to delete one by one manually. We are all lazy, so we should use tools to solve it. You don't need to rewrite the program, you can do it directly with the BAT command. Copy the following code to Notepad, save it as a bat executable file, put it in the CVS root directory, and execute it directly.

1

2

3

4

5

6

7

@echo off

echo Deleting CVS folders and files under: %1

REM Open Folder specified by parameter.

cd %1

REM Recursive delete command

for /f "tokens=*" %%i in ('dir /b/a/s CVS*') do @rmdir /q /s "%%i"

echo Done!

 

In addition, sometimes it is necessary to copy the recently modified files, including the directory structure corresponding to these files. Windows still gives a very powerful xcopy to solve this problem:

as follows

The first parameter is the original directory

The second parameter is the destination location

The third is the date, which means to copy all the files modified on and after that date

The last one is the list of excluded files, you can not. However, for developers, the results of compilation are often unnecessary, and the bin and obj folders can be filtered directly

bat content:

1

2

xcopy D:\sw\share\copyfiles\ D:\sw\share\copyfiles\target /D:03-25-2014 /S /R /Y /EXCLUDE:%CD%\exclude_file.txt

PAUSE

exclude_file.txt reference content:

1

2

3

4

5

6

\obj\

\Debug\

\Release\

\Bin\

.sln

.csproj

 


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326819997&siteId=291194637