工作中,需要将SVN的内容copy到其他的目录下进行开发和编译,这个时候会将svn的信息也copy过去。svn版本是通过隐藏的文件夹(.svn)来实现的,知道这个原理,就只需要删除该目录下的隐藏文件夹即可。
如是写了个批处理的方式。将该文件的内容copy到txt,然后修改后缀名(.bat)即可,例如:clearSVN.bat。在进行清理时注意清理的路径。
@echo off
echo ***********************************************************
echo 清除SVN版本信息 作者:Winfans 2012年10月18日14:43:54
echo ***********************************************************
:start
::启动过程,切换目录
:set pwd=%cd%
:cd %1
echo 工作目录是:& chdir
echo -----------------------------------------------------------
:input
::获取输入,根据输入进行处理
set source=:
set /p source=确定要清除当前目录下的.svn信息吗?回车键(q=退出)
set "source=%source:"=%"
if "%source%"=="q" goto end
if "%source%"=="Q" goto end
if "%source%"=="y" goto clean
::goto input
:clean
::主处理过程,执行清理工作
@echo on
@for /d /r %%c in (.svn) do @if exist %%c ( rd /s /q %%c & echo 删除目录%%c)
@echo off
echo -----------------------------------------------------------
echo 当前目录下的svn信息已清除
goto end
:noclean
::分支过程,取消清理工作
echo svn信息清楚操作已取消
goto end
:end
::退出程序
echo -----------------------------------------------------------
echo svn信息清除操作退出
echo -----------------------------------------------------------
pause
同时奉上清理系统垃圾的代码,网上很多,也是BAT文件。
@echo off
echo 【Winfans】提示:正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清除系统LJ完成...【Winfans】谢谢您的使用!
echo. & pause
清除SVN版本信息
猜你喜欢
转载自andrew-8323.iteye.com/blog/1741434
今日推荐
周排行