Files upload from shell

I’m running up2date ownyourbits ncp image as a docker container on rpi4 with dietpi as base system.
Besides I have another container running doing some bash scripts for me to create certain files on daily base.
In the past I uploaded these files that are stored on external USB drive with the Dropbox Uploader Script to my Dropbox or accessed them through ssh/ftp.
Now I want to be more independent with nextcloud and thought I easily can use a simple cp command to copy the files to my nextcloud location. :slight_smile:
Nextcloud is up and running but what would be the best way to copy these files, stored on USB drive, within a shell script to its nextcloud database destination?
Do I have to use ssh/ftp/scp or is there even a “networkless” way?
This nextcloud is volumed to the external USB drive as well but that wouldn’t make a big difference in my use case I think :smiley:

Search “nextcloudcmd”.

Thx @devnull that pointed me to right direction.
Today I ftp’ed a bit and found “/mnt/volumeonext/nextcloud/data/user/files” :smiley:
So both methods copy directly with cp or ftp and with docker cp from host to container should work.
But now my problem is that Nextcloud frontend won’t recognize the changes I made manually. It still shows the original file structure but “ls /data” inside the container shows me that the changes I made are correct. So why isn’t Nextcloud WebUI self updating?

Edit:
files:rescan is my friend :smiley:
I can do it with “docker exec -it containername /bin/bash”
and then “sudo -u www-data php /data/nextcloud/occ files:scan --all”
BTW how can I figure out the UID from my user?
The above does it well but I need it executed from inside a bash script…

You find it in /etc/passwd

Or

id
id username

@devnull
So you mean the system uid? I need the uid from nextcloud user to avoid scanning --all when refreshing :wink:
Im not planning to have so many users but is still interesting to know where to find it. --plainusername wont work for rescanning.

Also Im stuck in trail and error mode for finding a simple one liner to run rescan command from script at host.
But as Im writing this I think of having 2 scripts. 1 at host that triggers a script inside container and inside container for the rescan :wink: :wink:

Really? I have never test it.

docker exec --user www-data <containername> php occ files:scan --all

the help text is misleading. it should be user_name instead of user_id.

docker exec --user www-data <containername> php occ files:scan diggidre

thx @Reiner_Nippes
I thought it hast to be --usrname but without the – did it :wink:

But the above 1 liner wont work. No matter if I use container name or hash / id it tells me file or folder not found… and without containername in <> i get “Could not open input file: occ”

this is non-default path. maybe you have to add it.

docker exec --user www-data <containername> php /data/nextcloud/occ files:scan --all

why did you change the path?

@Reiner_Nippes
Ahh the path to occ is not standard… I don’t know why it’s different. Im using official NextcloudPi Image.
Solved :smiley: