I’m trying to find a solution for retention use case:
We want to use Nextcloud as temporary share. When any user uploads a file, it should be deleted after defined time period (exceptions possible).
I found Retention + Automated tagging of files + Files access control addons (links bellow), but as far as i understnand those, it doesn’t provide a way to use for ALL FILES - including those which admin doesnt see or has access to them, correct ? if those addons are enough for my usecase, can you help how to configure them to have the aim fulfilled ?
I also thought about using cron jobs/scripts, if this is possible for my usecase.
Can you point me to the right direction - which way to go ?
Is this possible in Nextcloud Enterprise, if there are any differences compared to comunity version ?
Nextcloud community forum = hobbyist voluntary support
If you run a licensed Nextcloud Enterprise, then it is highly advisable to contact Nextcloud GmbH support!
I’m not a developer and any real developer would probably laugh at my scripts calling me a novice.
While this is absolutely true, my scripts do what I expect them to do.
Here’s an example script for deleting all files in a defined path, min. directory depth 2, older than 7 days. you’ll need to adjust it to suit your needs i.e. valid path to OCC php-bin.
#!/bin/bash
##############################################################
# DESCRIPTION #
##############################################################
# Find and delete all files from a defined nextcloud path
# older than 7 days, run script daily as root cronjob
##############################################################
# VARIABLES #
##############################################################
LOG=".../logs/nextcloud-cleanup.log" ## define path to logfile
TARGET="/.../nextcloud/data/__groupfolders/1" ## define target
##############################################################
# SCRIPT #
##############################################################
### become root for manual issue, otherwise root crontab
sudo pwd;
### find and delete files and directories! mindepth 2
sudo find $TARGET -mindepth 2 -mtime +7 >>$LOG ;
sudo find $TARGET -mindepth 2 -mtime +7 -delete ;
### Nextcloud cleanup jobs
echo "SCAN FILES AND PERFORM SOME MAINTENANCE";
sudo occ files:repair-tree -n -vvv;
sudo occ files:scan --all -n -vvv;
sudo occ files:scan-app-data -n -vvv;
sudo occ files:cleanup -n -vvv;
## force purge trashbin per user and groupfolders
echo "PURGE TRASHBIN";
sudo occ trashbin:cleanup --all-users ;
sudo occ groupfolders:trashbin:cleanup -f ;
exit
WARNING
Use scripts at own risk. Adapt them to your needs, but be careful and double check!
Notice how almost every line is commented? That’s because I like to know what is happening and if I don’t write it down I’m bound to forget!
If you found what you need, that’s great and you’re welcome
NOTE
If you find any errors or typo’s, you can keep 'em
thank you very much - I will test the script.
regarding the differences between Enterprise and community - yes, I know that Enterprise has paid support (I run community version), my point was if there are some differences in Nextcloud features/functionalities - I take the answer as “no differences in functionalities”.