Move generated file from shell script to a nextcloud folder


I have created a shell script that creates a *.xslx from a database query. What is the best way to move this generated file to a folder in the Nextcloud so that it is also visible?
Simply moving it via mv doesn’t work, because it won’t be displayed in the Nextcloud.

Thanks very much!

If you use WebDAV or another Nextcloud function it is direct visible. If you copy it passing Nextcloud (e.g. cp) the Nextcloud database does not see the new file. Then you must use files:scan:

sudo -u www-data php occ files:scan --all
(or for a single user)


Maybe also Local external storage is an option for you.

1 Like

Ok, thanks! I’ll look into it. :slight_smile:

or you could set up a davfs-mount for that user and copy the file into it - this saves the trouble of running the occ-command manually on the server but may be a little much for just ONE file.