os.walk exclude .svn folders

前端 未结 2 1169
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 11:16

I got a script that I want to use to change a repeated string throughout a project folder structure. Once changed then I can check this into SVN. However when I run my script it

2条回答
  •  有刺的猬
    2021-02-13 11:55

    Try this:

    for root, subFolders, files in os.walk(rootdir):
        if '.svn' in subFolders:
          subFolders.remove('.svn')
    

    And then continue processing.

提交回复
热议问题