Versions: restore a list of files to the previous version

Hello,
i a trying to find a solution to restore approximately 1600 pdf files to the previous last version. All of these pdf files are 0 byte. My suspicion is that something went wrong with OCR Workflow. But i did not investigating this further so far.

With

find . -type f -iname '*.pdf' -empty > list.txt

i was able to get all of these files. Is there a way to restore them with an occ command or something else? Any other ideas are also welcome.
Thanks!

I would recommend to copy the files to the desired directory and then use the ā€œocc files:scan ...ā€ command to update the directory index of the destination directory.

Thanks j-ed for pointing me in the right direction!
The situation is likely related to a bug in Workflow OCR. https://github.com/R0Wi/workflow_ocr/issues/79
With a script i could overwrite the files from ā€œuser/files_versions/ā€¦ā€ to ā€œuser/files/ā€¦ā€ and then did a ā€œocc files:scan userā€.
The nextcloud webpage shows the reverted PDF files now correctly. However, my Linux desktop client 3.0.2 (Ubuntu) is not updating. Cron jobs are running fineā€¦

1 Like

To solve this i had to:

  1. Use a script to detect all zero byte PDFs in ā€˜user/files/ā€™ directory, cross-check if an older version is available in ā€˜user/files_versions/ā€™ directory and then overwrite the empty PDF with the newest version
  2. run sudo -u www-data php occ files:scan --all
    This was only updating PDF files on Nextcloud website
  3. uncheck ā†’ apply ā†’ check all related folders in desktop client
    Why? I donā€™t know. But i got all PDFs back on my computer.

Holy guacamole! :avocado:

in the post below I described the way to find the files with invalid mtime from DB. Size attribute exists in the filecache database table as well. you could start with the same approachā€¦