您的位置:軟件測試 > 開源軟件測試 > 開源配置管理工具 > SVN
清除svn關(guān)聯(lián)
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2014/2/18 16:54:21 ] 推薦標(biāo)簽:svn 關(guān)聯(lián)

# -*- coding: GBK -*-
import os,stat,shutil;
#更改文件權(quán)限
def subFileChmod(_sPath,_stat):
    #獲得路徑下文件列表
    itemsInDir = os.listdir(_sPath);
    for item in itemsInDir:
        #文件添加路徑 sItemPath為
        #路徑_sPath下的文件路徑
        sItemPath = os.path.join(,item);
        #os.chmod 更改文件權(quán)限
        os.chmod(sItemPath,_stat);
        #判斷文件是否為目錄
        if os.path.isdir(sItemPath):
            subFileChmod(sItemPath,_stat);
#執(zhí)行刪除函數(shù)
def delSVNDirs(_sPath):
    itemsInDir = os.listdir(_sPath);
    for item in itemsInDir:
       sItemPath = os.path.join(_sPath,item);
       if os.path.isdir(sItemPath):
           if item == ".svn":
               print "刪除" + sItemPath
               subFileChmod(sItemPath,stat.S_IREAD|stat.S_IWRITE)
               #刪除文件
               shutil.rmtree(sItemPath)
           else:
                delSVNDirs(sItemPath);
#配置刪除svn的文件路徑        
_sPath = "D:"
delSVNDirs(_sPath);

軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd