An app for Nextcloud to automatically archive files based on file age. Archived files are moved to the .archive folder for each user, which is hidden from mobile apps to prevent re-uploading but remains accessible via the web interface.
- Automatic Archiving: Archive files based on age (no tags required)
- Mobile App Hidden: Archive folder is prefixed with a dot (
.archive), making it invisible to mobile apps and preventing re-upload - Web Accessible: Archived files remain accessible through the web interface (enable "Show hidden files" in Files app settings)
- Time-Based Rules: Create archive rules based on file age
- Flexible Time Periods: Configure archive periods in days, weeks, months, or years
- Date Calculation: Choose to calculate from creation date or last modification date
- Per-User Archives: Each user gets their own
.archivefolder
- Nextcloud 28-33
- PHP 8.2 or higher
- Node.js 24+ and npm 11+ (for building frontend assets)
- Composer (for PHP dependencies)
- Clone or download the app:
cd /path/to/nextcloud/apps
git clone https://github.com/mdhemmi/time_archive.git- Install PHP dependencies:
cd time_archive
composer install --no-dev- Install and build frontend assets:
npm ci
npm run build-
Enable the app:
- Via web UI: Go to Apps → Find "File Archive" → Enable
- Via CLI:
php occ app:enable time_archive
-
Run database migrations:
php occ upgrade- Go to Settings → Administration → Workflow → File Archive
- Create an archive rule:
- Set the archive period (e.g., 1 year)
- Choose time unit (Minutes/Hours/Days/Weeks/Months/Years)
- Select date calculation method (Creation date or Last modification date)
- Files matching the age criteria will be automatically archived to
.archivefolder for each user - You can manually trigger archive jobs using the "Run archive now" button
Note: Archive rule configuration is restricted to administrators only. Regular users cannot create, modify, or delete archive rules.
Regular users can:
- View their archived files via the Archive view (accessible from the top navigation bar)
- Access archived files through the Files app (enable "Show hidden files" in settings)
Regular users cannot:
- Create, modify, or delete archive rules
- Manually trigger archive jobs
- Files are moved (not deleted) to the
.archivefolder in each user's home directory - The archive folder is hidden from mobile apps (dot-prefixed) to prevent re-uploading
- Background jobs run daily to check and archive files for all users
- Archived files remain accessible via the web interface
- Each user has their own
.archivefolder, ensuring files are organized per user - Protected folders: Top-level folders used by mobile apps (Camera, Photos, SofortUpload, etc.) are never archived to prevent breaking auto-upload functionality. Files inside these folders can still be archived, but the folders themselves remain.
To configure additional protected folders (folders that should never be archived), you can set them via Nextcloud's occ command:
php occ config:app:set time_archive protected_folders --value "MyCustomFolder,AnotherFolder"The default protected folders include: Camera, Photos, Documents, Screenshots, Videos, Downloads, DCIM, Pictures, Images, SofortUpload.
Note: Only top-level folders (direct children of /user/files/) are protected. Subfolders can still be archived.
The .archive folder is hidden from mobile apps but accessible via the web interface:
- Floating Archive Button: When viewing the Files app, a floating Archive button appears in the bottom-right corner. Click it to access the dedicated Archive view listing all your archived files.
- Dedicated Archive View: You can also access the Archive view directly via:
https://your-nextcloud.com/index.php/apps/time_archive/ - Show Hidden Files: Enable "Show hidden files" in Files app settings to see the
.archivefolder in the folder tree and Favorites section. - Direct URL to Archive Folder: You can also access the archive folder directly via:
https://your-nextcloud.com/index.php/apps/files/?dir=/.archive
Important Note: The .archive folder is dot-prefixed (hidden) to prevent mobile/desktop clients from syncing it. Due to Nextcloud's Files app behavior, dot-prefixed folders do not appear in the Favorites section when "Show hidden files" is disabled, even if they are favorited. To see it in Favorites, you must enable "Show hidden files" in Files app settings. Alternatively, use the dedicated Archive app view for the best experience.
Note: For existing .archive folders created before the favorite feature, run php occ maintenance:repair to add them to favorites (they will appear in Favorites only when "Show hidden files" is enabled).
# Install dependencies
composer install
npm ci
# Build for development
npm run dev
# Build for production
npm run build
# Watch for changes
npm run watchFor detailed instructions on building the app and creating releases for the Nextcloud App Store, see:
- BUILD_AND_RELEASE.md - Complete guide covering:
- Building the app (development and production)
- Creating release archives
- Signing the app
- Uploading to the Nextcloud App Store
- Automated releases with GitHub Actions
- Troubleshooting common issues
Quick start for releases:
- Update version in
appinfo/info.xml - Build:
composer install --no-dev && npm ci && npm run build - Create archive:
tar -czf time_archive-VERSION.tar.gz time_archive/ - Sign:
php occ app:sign time_archive --privateKey=... --certificate=... --path=/tmp - Upload to https://apps.nextcloud.com
AGPL-3.0-or-later