Hi Dmitry,
I finally applied the script which ran fine. However, trying then to scan all new files added to my external storage (via rsync), I got plenty of errors:
> Scanning files for 4 users
> Starting scan for user 1 out of 4 (admin_live)
> Exception during scan: Undefined index: size
> #0 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(421): OCA\Files\Command\Scan->exceptionErrorHandler(8, 'Undefined index...', '/var/www/vhosts...', 421, Array)
> #1 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(382): OC\Files\Cache\Scanner->handleChildren('20. Clients et ...', true, 3, '10102', true, 1522221)
> #2 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '10102', true)
> #3 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8172', true)
> #4 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8135', true)
> #5 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8126', true)
> #6 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '7703', true)
> #7 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(316): OC\Files\Cache\Scanner->scanChildren('', true, 3, '44', true)
> #8 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Utils/Scanner.php(235): OC\Files\Cache\Scanner->scan('', true, 3)
> #9 /var/www/vhosts/bcasmart.com/httpdocs/oc/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/admin_live')
> #10 /var/www/vhosts/bcasmart.com/httpdocs/oc/apps/files/lib/Command/Scan.php(228): OCA\Files\Command\Scan->scanFiles('admin_live', '/admin_live', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
> #11 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Command/Command.php(262): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/vhosts/bcasmart.com/httpdocs/oc/core/Command/Base.php(159): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(826): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #15 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #16 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Console/Application.php(160): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #17 /var/www/vhosts/bcasmart.com/httpdocs/oc/console.php(106): OC\Console\Application->run()
> #18 /var/www/vhosts/bcasmart.com/httpdocs/oc/occ(11): require_once('/var/www/vhosts...')
> #19 {main}
> Starting scan for user 2 out of 4 (ccianchi)
> Starting scan for user 3 out of 4 (flhermitte)
> Starting scan for user 4 out of 4 (jlgarnier)
> Home storage for user jlgarnier not writable
> Make sure you're running the scan command only as the user the web server runs as
> +---------+-------+--------------+
> | Folders | Files | Elapsed time |
> +---------+-------+--------------+
> | 313 | 2093 | 00:00:05 |
> +---------+-------+--------------+
Does it ring any bell to you?
Thanks in advance for your advices!