--- a/dav/main.c Thu Jul 09 17:22:55 2015 +0200 +++ b/dav/main.c Fri Oct 02 13:18:17 2015 +0200 @@ -375,7 +375,7 @@ while(ret != 0) { ls = dav_query( sn, - "select `idav:crypto-name`,`idav:crypto-key` from %s with depth = %d where lastmodified > %t", + "select `idav:crypto-name`,`idav:crypto-key` from %s with depth = %d where lastmodified > %t order by iscollection desc, name", path, depth, t);