添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
笑点低的啄木鸟  ·  通过 Apache Hive 和 ...·  8 小时前    · 
文雅的椅子  ·  安装Mujoco、mujoco-py、gym ...·  5 小时前    · 
俊秀的毛衣  ·  OpenLayers链接_openlayer ...·  9 月前    · 
干练的滑板  ·  在 ASP.NET Web API 2 | ...·  2 年前    · 
绅士的电脑桌  ·  java - "Refused to ...·  2 年前    · 
无聊的柚子  ·  解决:target\surefire-rep ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to sync two different directories using the dirsync module, but exclude some specific folders. In the documentation ( https://pypi.org/project/dirsync/ ) it says the exclude need to be a regex pattern but I cant quite make it work. For example, lets say we have these directories c:\folder1\folder2

c:\folder1\folder3

d:\folder1\

I want to sync c:\folder1\ with d:\folder1\ and exclude folder3, so basically the folder c:\folder1\folder2 will be copied and created in d:\

from dirsync import sync
src = r'c:\folder1'
dst = r'd:\folder1'
sync(src, dst, 'diff', exclude='^folder3')

this won't work and I can't quite understand why.

@ScottHunter without the exclude, the output contains which files and directories exist only in the source folder (in my example, folder2, folder3), after adding the exclude it will say there is no difference at all. – user134456 Dec 13, 2021 at 14:22

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.