添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
腼腆的柠檬  ·  python ...·  6 天前    · 
有情有义的大白菜  ·  python ...·  6 天前    · 
完美的馒头  ·  python QTreeWidget ...·  3 天前    · 
失眠的烤红薯  ·  python qt textBrowser ...·  昨天    · 
欢快的罐头  ·  影帝古穿今 - 抖音·  1 年前    · 
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.