To force a scan after a manual file transfer, for example, can be done as follows:
sudo -u [USER] php occ files:scan --all
for example:
sudo -u john php occ files:scan --all
Usage:
files:scan [-p|--path="..."] [-q|--quiet] [-v|vv|vvv --verbose] [--all]
[user_id1] ... [user_idN]
Arguments:
user_id will rescan all files of the given user(s)
Options:
--path limit rescan to the user/path given
--all will rescan all files of all known users
--quiet suppress any output
--verbose files and directories being processed are shown
additionally during scanning
--unscanned scan only previously unscanned files
Source: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html