Auto Sync filedirectory database after sync

Does there exist a clever way to update the file directory database after an sync.
The way im syncing is using truenas cloud sync to push some folders to nc, and in reverse, the issue happens when the files are pushed to the nc since it is using an sftp connection to push the data to nc so they don’t appear on the web ui.
The solution I found so far is:

sudo -u abc php /config/www/nextcloud/occ files:scan --all //to refresh the database

ok, i know how to update it but dont know how to trigger it,
the only solution that comes to mind is bruteforce (cronjob once a day at an approximate time the sync should have finished)
now does there exist an more elegant way do deal with my issue?
any ideas are appreciated