Nextcloud docker container on Unraid having trouble discovering new files on external storage.

I have an instance of the community maintained Nextcloud (GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud) docker running on my Unraid server (version 7.0.0).

The goal is to set up an Unraid share that Nextcloud can access instead of holding my files in appdata. I have configured it with an additional path to the share ‘/mnt/user/Dropbox’ such that I can access the external share in Nextcloud just fine when configuring it in the administration settings.

The issue I’m having is: how do I scan for newly added files that were added directly to this share - not through the Nextcloud UI?

I have tried executing the command

docker exec -it Nextcloud /bin/bash

to start a terminal within the container then

php occ files:scan --all

but received this error:

Exception during scan: "files/5378384889722127a01c2b9b7192c5a3"("scanner::") is locked
#0 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(592): OC\Files\Storage\Common->acquireLock('scanner::', 2, Object(OC\Lock\DBLockingProvider))
#1 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(592): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\DBLockingProvider))
#2 /var/www/html/lib/private/Files/Cache/Scanner.php(323): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\DBLockingProvider))
#3 /var/www/html/lib/private/Files/Utils/Scanner.php(255): OC\Files\Cache\Scanner->scan('', true, 3)
#4 /var/www/html/apps/files/lib/Command/Scan.php(153): OC\Files\Utils\Scanner->scan('/kyle', true, NULL)
#5 /var/www/html/apps/files/lib/Command/Scan.php(214): OCA\Files\Command\Scan->scanFiles('kyle', '/kyle', NULL, Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#6 /var/www/html/3rdparty/symfony/console/Command/Command.php(326): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/3rdparty/symfony/console/Application.php(1078): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/lib/private/Console/Application.php(183): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/console.php(87): OC\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#13 /var/www/html/occ(11): require_once('/var/www/html/c...')
#14 {main}

The next issue once this is sorted is, how do I automate this?

Thanks for any help!