Occ groupfolders:scan - files and folders mixed up

When running occ groupfolders:scan, files and folders are mixed up.

** more of a cosmetic issue **

For example:

$ occ groupfolders:scan 3
±----------±--------±------±-------------+
| Folder Id | Folders | Files | Elapsed time |
±----------±--------±------±-------------+
| 3 | 2334 | 179 | 00:00:01 |
±----------±--------±------±-------------+

In reality, the said group folder has 2334 individual files in 179 directories.

It’s been a while since I first noticed it and it is still the same with the latest update (Nextcloud 27.1.1 / Group folders 15.3.1).

It is worth noting that file:scan does not exibit this behaviour

The groupfolders app still swaps the files and folders, but in my case it even counts differently:

+-----------+---------+-------+--------------+
| Folder Id | Folders | Files | Elapsed time |
+-----------+---------+-------+--------------+
| 4         | 163539  | 7660  | 00:01:09     |
+-----------+---------+-------+--------------+

The tree -l . command within the groupfolder yields: 7652 directories, 163148 files.
(trash: 95 directories, 3233 files; versions: 1667 directories, 1733 files)

However you count, you can’t reproduce groupfolders:scan 4’s output.

Question to the dev(s): are files/folders in trash and versions scanned and counted too?

Looks like this was indeed switched in code, created a PR at Fix display of files/folders in scan command by SystemKeeper · Pull Request #2703 · nextcloud/groupfolders · GitHub

For how the command works, see groupfolders/lib/Command/Scan.php at master · nextcloud/groupfolders · GitHub

1 Like

Thank you for the link.
I’m totally 404 when it comes to PHP, but as far as I have skimmed through the code, trash and versions are not scanned.

So, how can I issue a refresh versions & trash command?