Hi, let’s say I have another app that generates files in the nextcloud directory “user/files/folder1/”, how can I get nextcloud to automate adding the new file into NC without having to type out the OCC command manually each time?
I currently normally run this with the occweb app files:scan --path=user/files/folder1
Would usually run this instead of files:scan --all as it would take too long. Any alternate ways to add the file without scanning the whole folder would be even better!
I’m running NC20 on docker, using the latest image.
I note that there’s the workflow scripts app, and I also use rcdailey/nextcloud-cronjob. Any simple way to get the desired effect working?
Perhaps another way. I use an additional file uploader (https://tinyfilemanager.github.io/) to upload to an external dir on the same server but outside Nextcloud. In Nextcloud i have mounted the external directory (not in nextcloud/data) with “external storage” (type local). If i upload files i found them after reload the folder in Nextcloud.
Install the workflow_scripts app, create a batch script which is being executed on a new file creation event and force an “occ files:scan ...” command. Other users have already used it for various jobs, see e.g.:
That’s right, because this is the only case where Nextcloud is aware of file system changes. If you’re by-passing the Nextcloud gui you have to make sure that a file scan is triggered afterwards.
I have solve this problem by writing an simple auto_scan.sh.
I use docker for nextcloud server,and when starting docker,i run this script at the same time.
Here is the script
while inotifywait -r -e modify,create,delete “$DIRECTORY”
do
# 执行命令
echo “文件夹发生变化,执行命令: $COMMAND”
sleep 5
eval “$COMMAND”
done
change DIRECTORY and COMMAND to yours,and save it.
run ./auto_scan.sh and then it’s solved.
if you want to put the program into the background,you can use the screen for it.
oh,I just find another method to solve it.
get to your config.php and add a new line like this:
‘filesystem_check_changes’ => 1,
1 represent checking any request to the folder and update it in nextcloud.
0 represent doing nothing
this method is such wonderful! it’s seem that i had wasted much time for writting a script