diff -r 481802342fdf -r ceed7714846a dav/sync.c --- a/dav/sync.c Mon Feb 04 17:17:48 2019 +0100 +++ b/dav/sync.c Sat Feb 23 18:58:53 2019 +0100 @@ -1191,7 +1191,6 @@ UCX_FOREACH(elm, resources) { LocalResource *local_res = elm->data; - // ignore all files, that are excluded by a static filter (sync.xml) // static include/exclude filter @@ -1245,7 +1244,8 @@ // find all deleted files and cleanup the database UcxMapIterator i = ucx_map_iterator(db->resources); LocalResource *local; - UCX_MAP_FOREACH(key, local, i) { + UcxList *removed_res = NULL; + UCX_MAP_FOREACH(key, local, i) { // all filtered files should be removed from the database if(res_matches_filter(dir, local->path+1)) { ucx_map_cstr_remove(db->resources, local->path); @@ -1266,10 +1266,14 @@ if(!archive) { ls_delete = ucx_list_append(ls_delete, local); } else { - ucx_map_cstr_remove(db->resources, local->path); + removed_res = ucx_list_prepend(removed_res, local); } } } + UCX_FOREACH(elm, removed_res) { + LocalResource *local = elm->data; + ucx_map_cstr_remove(db->resources, local->path); + } ls_delete = ucx_list_sort(ls_delete, (cmp_func)resource_pathlen_cmp, NULL);