Sync folders on remote Nextcloud server automatically

Hello, hopefully someone will be able to help.

I have installed nextcloud on a remote KVM server, in docker using portainer.
The version was the linuxserver/nextcloud:latest image ( Nextcloud 21.0.0) with MariaDB.

The use case I have for using nextcloud is multi purpose, but one area i wanted to use if for was to keep a remote copy of jpg and mp4 from a motioneye server in my home.

The files for motioneye are stored on a local NAS (openmediavualt) via SMB, and I have setup SFTP external storage from the OMV NAS, in Nextcloud.

Now what i wrongly assumed was that the files would be copied to the nextcloud server, not just mounted as an external remote drive. But I had not done enough reasearch, and obviously the files are inaccessable if there is no connetion to the OMV-NAS.

Is there a way to keep the files on the nextcloud server, without manually copying them from the external storage folder? Can the files be written localy via the SFTP external storage, so that if the internet connection drops, the external folder has a local copy to view?

Is it possible somehow to run a cron job to copy them from the SFTP external storage folder to a folder on the nextcloud server?

I looked at rsync push (avalable in openmediavault) to a folder on the KVM server outside of the nextcloud docker container but I am not very experienced with linux, and can’t find a guide on how to use rsync, or how to mount a partion on the nexcloud server outside of the docker container, so I gave up on that.

I used to use the “Upload Media Files” option in Motioneye to google drive, But i am really trying to degoogle my life. Motioneye has an upload to SFTP server option, but as far as i know nextcloud onlt has an SFTP client built in.

If anyone can give me an idea or work around i would be greatful.

Thanks

I managed to use RSYNC in the end and mounted the external storage as local in nextcloud.