2017-05-05 11:52 GMT+02:00 Serhiy Storchaka <storch...@gmail.com>: > On 05.05.17 10:58, George Fischhof wrote: > >> I have a task to synchronize folders but some files should be remained >> untouched. >> I think this is a very common task. >> >> I found that shutil.copytree() has ignore_patterns() but rmtree() has not. >> >> So here comes my idea: add ignore_patterns() to rmtree() it is a good >> feature and makes the functions symmetric. >> > > You can't remove a tree when remain its branches. Thus rmtree() with > ignore_patterns will always fail. > > For your particular case I suggest to use os.walk(). You can implement > arbitrary application specific conditions. > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
If the remaining equals to ignore_pattern plus the container folders, then it is succesful ;-) In my opinion
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/