@echo On
@Rem 删除CVS版本控制目录
@PROMPT [Com]#
@echo Find CVS
@for /r . %%a in (.) do @if exist "%%a\CVS" @echo "%%a\CVS"
@echo Find CVS Dir....OK
@pause
@for /r . %%a in (.) do @if exist "%%a\CVS" rd /s /q "%%a\CVS"
@echo Clear CVS Dir Mission Completed
@pause
@Rem 删除CVS版本控制目录
@PROMPT [Com]#
@echo Find CVS
@for /r . %%a in (.) do @if exist "%%a\CVS" @echo "%%a\CVS"
@echo Find CVS Dir....OK
@pause
@for /r . %%a in (.) do @if exist "%%a\CVS" rd /s /q "%%a\CVS"
@echo Clear CVS Dir Mission Completed
@pause
而且我发现Dreamweaver也会在站点目录中存放许多_notes目录,参考上面的脚本再编写一个新的ClearNotes.bat如下
@echo On
@Rem 删除_notes目录
@PROMPT [Com]#
@echo Find _notes
@for /r . %%a in (.) do @if exist "%%a\_notes" @echo "%%a\_notes"
@echo Check _notes Dir ....OK
@pause
@for /r . %%a in (.) do @if exist "%%a\_notes" rd /s /q "%%a\_notes"
@echo Clear _notes Dir Mission Completed
@pause
@Rem 删除_notes目录
@PROMPT [Com]#
@echo Find _notes
@for /r . %%a in (.) do @if exist "%%a\_notes" @echo "%%a\_notes"
@echo Check _notes Dir ....OK
@pause
@for /r . %%a in (.) do @if exist "%%a\_notes" rd /s /q "%%a\_notes"
@echo Clear _notes Dir Mission Completed
@pause
这样就可以轻松解决目录冗余的问题了。
=======================================================================
我编写了一个Python程序,也可以完成清除CVS目录的工作
# yankchina@gmail.com
# Clear CVS Folder
def ClearCVSFolder( inFolderName ):
''' Clear CVS Folder
'''
import os
for root, dirs, files in os.walk( inFolderName , topdown = False ):
for name in dirs:
cvsname = root +'\\' + name + '\\cvs\\'
if os.path.isdir( cvsname ):
os.remove( cvsname )
print 'Remove CVS DirectoryName:' + cvsname
# InputMain Function
def inputMain():
import sys
if len(sys.argv)>=2:
currentDir = sys.argv[1]
else:
print "Please Input Folder Name: "
currentDir = raw_input()
print "Clear CVS Label Folders"
ClearCVSFolder(currentDir)
print "Any Key To Return..."
currentDir = raw_input()
if __name__ == "__main__":
inputMain()
# Clear CVS Folder
def ClearCVSFolder( inFolderName ):
''' Clear CVS Folder
'''
import os
for root, dirs, files in os.walk( inFolderName , topdown = False ):
for name in dirs:
cvsname = root +'\\' + name + '\\cvs\\'
if os.path.isdir( cvsname ):
os.remove( cvsname )
print 'Remove CVS DirectoryName:' + cvsname
# InputMain Function
def inputMain():
import sys
if len(sys.argv)>=2:
currentDir = sys.argv[1]
else:
print "Please Input Folder Name: "
currentDir = raw_input()
print "Clear CVS Label Folders"
ClearCVSFolder(currentDir)
print "Any Key To Return..."
currentDir = raw_input()
if __name__ == "__main__":
inputMain()
0 评论:
发表评论