Upgrading an app, with particular files/directories preserved

Hello,

I must say I enjoyed integrating my application with Nextcloud, the documentation is very helpful. The only issue I currently have is upgrading the application, the docs seem to be quite limited on that topic, and I can’t figure out how to retain certain files/folders when upgrading an app, rather than overwriting those by content of a new app package, so I thought I ask for pointers here. Thanks.