Skip to content

ownCloud Files Scan Not Working

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about owncloud files scan not working. We cover key concepts, practical examples, and best practices.

Hook

You upload files via SFTP directly to your ownCloud data directory. They are there on disk — you can see them with ls. But ownCloud's web interface shows the old file listing. The file scanner is not detecting your new files.

The Wrong Way

Running occ files:scan without the --all flag or as the wrong user only scans a single user's files, missing everything else.

# BAD: Scanning only one user
sudo -u www-data php occ files:scan alice
Scanning files for user alice (1234 files)
New files found: 0

If the files belong to a different user or are in a shared folder, scanning only alice finds nothing.

The Right Way

Scan all users or the specific path where files were added.

# 1. Scan all users
sudo -u www-data php occ files:scan --all
Scanning files for user alice (1234 files) — 2 new files found
Scanning files for user bob (567 files) — 0 new files found
# 2. Scan a specific path
sudo -u www-data php occ files:scan --path="/alice/files/Photos"
Scanning /alice/files/Photos — 12 new files found
# 3. Force re-scan even for unchanged files
sudo -u www-data php occ files:scan --all --unscanned
Re-scanning all files — updating file cache

If files still do not appear, the files may be outside ownCloud's data directory or in an external storage mount that ownCloud does not track.

# Check external storage config
sudo -u www-data php occ files_external:list

Prevention

  • Always use ownCloud's web upload or sync client instead of direct SFTP.
  • If you must use SFTP, run occ files:scan --all immediately after.
  • Set up a cron job: */5 * * * * sudo -u www-data php /var/www/owncloud/occ files:scan --all.
  • Use the files_automatedtagging app to trigger scans on file changes.
  • Monitor the ownCloud log for file-scan errors.

Advanced Troubleshooting

Check the Logs

Most TOOL errors are logged to stdout or a dedicated log file. Check your logs first:

# Check system logs
journalctl -u tool --since "1 hour ago"

# Or check the application log
tail -50 ~/.tool/logs/error.log

Test with a Minimal Example

Create the simplest possible tool configuration to verify the base setup works:

tool --version
tool --help

If the minimal test passes, add configuration options one at a time until you find the breaking change.

Common Configuration Mistakes

  • Using the wrong file path or URL in configuration
  • Forgetting to restart TOOL after changing config files
  • Mixing tabs and spaces in YAML configuration files
  • Setting incorrect permissions on configuration directories

When to Reinstall

If none of the above resolves the issue, consider a clean reinstall:

# Backup your configuration
cp -r ~/.tool ~/.tool.bak

# Remove and reinstall
# Follow the official TOOL installation guide

This ensures you start from a known good state and can isolate the issue.

Common Mistakes with files scan

  1. Forgetting deriving (Show, Eq) on custom data types needed for debugging
  2. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  3. Using head and tail instead of pattern matching, causing runtime errors on empty lists

These mistakes appear frequently in real-world OWNCLOUD code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

How does ownCloud detect new files?

ownCloud uses a file-cache database that is updated by the scanner. It does not use inotify or filesystem events. You must trigger occ files:scan manually or via cron.

Why does occ files:scan say 'No new files found' when there are new files?

The files may be in a directory that ownCloud ignores (e.g., .stversions for the versions app) or may not be readable by the web server user. Check file permissions.

Can I scan only one folder?

Yes — use the --path option: occ files:scan --path="/username/files/foldername". This is faster than scanning the entire user's files.


DodaTech — every file found, every time.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro