**Quick description:** `seafile_recovery` is a low-level tool that parses Seafile's on-disk file storage.
Compared to other tools, it works without the associated sqlite or MySQL database.
**Some use cases:** I developped this tool because I lost my database and wanted to get back my files.
It can also help you to diagnose problems with Seafile's on-disk file storage and maybe repair them.
Finally, it can help you better understand how Seafile is working internally and gather some statistics about your Seafile's repositories health.
**Features and limitation:** The tool can parse all commits of a repository, currently the `head` subcommand selects the "last" one according to the commit graph and an heuristic based on time. Each commit contains a `RootId`. All files and folders have an Id in Seafile, the `RootId` is simply the Id of the root folder of the repository at the time of the commit. You can inspect these Ids with `ls`. You can copy a file or a folder hierarchy on your disk with `cp`. Finally the `s3` subcommand directly transfer the file or folder hierarchy to a S3-compatible storage. Currently, the tool does not work with encrypted repositories. Advanced Seafile features are not tested. Finally, the tool has not been extensively tested and may crash when encountering some unusual edge cases.
**Disclaimer:** This tool is community made and thus not affiliated to Seafile Ltd., Seafile Gmbh. or any company.
The development of this tool has been done for my own needs, I can not be held responsible for any issue or damage it can cause.
Use it carefully or none at all if you are not sure of what you are doing, data are often more precious than we imagine.
Always shutdown your Seafile daemons before using it (both Seafile and Seahub).
Create a backup before running any command and double check all your operations.
We know learnt some information about the repository, especially its name ("Ma bibliothèque"), who did the last change ("quentin@example.com") and the RootId ("5911dd2d363f591e43df4e80591d0a54975f2aaf").
We can now explore its last file hierarchy thanks to the RootId (we can only copy a part of the Id to keep the command more readable):
```
$ seafile_recovery ls 0011d396-4890-463a-8266-bcbd978d8d1c --dir=5911dd2
2021/04/28 15:15:40 5911dd /
2021/04/28 15:15:40 b88ab9 /seafile-tutorial.doc
2021/04/28 15:15:40 d24616 /Capture d’écran de 2021-04-11 23-07-31.png
2021/04/28 15:17:28 380a0e /Capture d’écran vidéo de 19-12-2020 10:30:15.webm
```
**Be careful !** This tool is not intended to change your seafile backend from local filesystem to the S3 backend. Migrating to the S3 backend implies to keep Seafile's objects which is a totally different job. Appropriate scripts are available from Seafile's official distribution.