Hi, I want nextcloud delete files older than X days, but only for some users and only for some directory, how to achieve it?
my nextcloud have some users, use foldersync/android app to sync Whatsapp files to nextcloud,
(android/whatsapp <-> nextcloud/whatsapp folder, two way sync),
and they want delete files in this whatsapp folder older 180 days.
use shell script / cron,
find /nextcloud/data -type f ( -mtime +180 -o -ctime +180 ) -exec rm -f {} ;
then sudo -u _cloud php /var/www/nextcloud/occ files:scan --all
is it OK? what is the proper way to achieve it? any idea?
Thanks.
Have the read some information about the files-retention app? You opened this thread under that category already
In my opinion a shell script doesn’t make sense here. Rather use auto-tagging and files retention. Both can be found for an admin user under “Settings” -> “Workflow”
There you can:
create Collaborative Tags, for example “Auto-Delete” and “WhatsApp”
create an entry for “Automated Tagging”, for example
Damn, I forgot to mention the step to add the tag “WhatsApp” to the file WhatsApp (in which your files are you want to delete after 180 days).
So open the details of that folder and add tag WhatsApp in the top of the details. You’ll find it.
Can’t create a screenshot right now.
In case that tag symbol is totally missing, please check that:
nothing is blocking content from the web GUI (uOrigin and sometimes some antivirus tools are blocking content (buttons), so probably disable them testwise)
you cleared your browser cache
fully reload your web site in the browser by pressing CTRL + F5
My nextcloud is version: 14.0.4
and the apps is, Collaborative tags 1.4.0, Files automated tagging 1.4.0, Retention 1.3.1.
I still can not tag the file/folder manually, when I click the Tags on web interface,
It show nothing (yes, I already added public tag name “whatsapp”).
I do not know why, I just can not assign them
Unfortunately all my servers are on NC15 right now. I will check on my server anyway if I see further issues there as well.
Maybe somebody of you could investigate a little further on your servers.
Browser console output, maybe have a look at the browsers investigator if some elements are “hidden”.
Check if there are error messages in the Nextcloud log as well please.
I just ran some tests. Tagging and Automatic Tagging perfectly work with NC15.
Retention on the other hand only work with a small limitation: you can create a new retention, but you can see your configured retentions in the web GUI afterwards and therefor cannot remove them via retention settings.
They can be likely removed by deleting the tag itself, but I haven’t tested that so far, because I was on prod server.