"The G Company" here means the company starting with G and ending with E. Combining this with "DriveFS", you know what service and what company I'm talking about...
So... one day, my account from "that G company" was suddenly suspended because of some silly reasons, and they didn't seem to care about bringing it back, so all of my data from "that service" was gone forever. That account had many of my important data, so I'm doing my best to at least get back some of it...
Until I realized that I'd installed the desktop app before for easier syncing, and it had created a folder called DriveFS to cache some of my data to my local drive. And you guessed it right, it was the only hope to get (some of) my important data back at that moment.
Thank "that company" for at least being generous enough to leave some cached files. Obviously, it didn't contain all of my data (since my local hard drive wasn't big enough to store all of those), but it was better than nothing.
So what's the lesson we learned from this situation? Don't trust any cloud providers. Back up your important data to at least an external drive that you can manage on your own. Don't let any corporations be able to nuke your data anytime they want.
If your account is suddenly suspended/disabled, but you realize that the cached DriveFS folder is still intact in your local drive, this tool will help you recover some of the files in that cached folder.
Basically, this tool will turn this:
into this:
I'm not willing to stop this tool development at this state. There are many more features that I'm willing to add in the future, including:
- Restoring the original file names, modified dates, and even the original folder structure based on the given
metadata_sqlite_db. - Being able (in some way) to recognize the plain text (non-binary) files, such as
.html,.xmland other coding language files.
After researching, it turned out that the cached files in the DriveFS folder are just raw files without any encryption.
By recognizing the magic header in each file, we can at least sort the files into various file types in their respective folders, and the rest is up to you.
This tool will only change the extensions of all files and sort them, without changing any of their contents. Your cached files will be as intact as they were.
- Currently, there's no way to restore the original names, folder structures and modified dates. The file names will be the same as the cached files in the
content_cachefolder.
Even if theDriveFS\<user_id>\metadata_sqlite_dbfile containing the file names still exists, I haven't know a way to make the tool know which cached file is which entry in the database. The numbers in the cached file names can't help anything. - Plain text files (
.txt,.html,.php, etc.) won't be sorted and will be moved to theUnspecifiedfolder, since I haven't found a way how to sort those kind of files. - Some document files can't be recognized and will throw an error related to
@tokenize/inflate. I haven't found a way how to fix it yet.
Node.js 18 or later is required.
- Clone the repository (or download the latest source code and
cdinto the extracted folder):
git clone https://github.com/Serena1432/drivefs-cache-extract
cd drivefs-cache-extract- Run the script:
node drivefs "source_folder" "target_folder" [--faster] [--ignore-existing] [--move] [--log]source_folder: Thecontent_cachefolder path, which is usuallyDriveFS\<user_id>\content_cache.target_folder: The destination folder path with sorted files.--faster: Read only the first 1 KB of the file instead of the entire file. The process will be faster, but the result may be less accurate.--ignore-existing: Don't copy the file if the destination file already exists and has the same file size.--move: Move the file into the destination folder instead of copying.
Be careful when using this option. There's no way to restore the DriveFS folder after running the script.--log: Create a log file in the destination folder containing all extracted files and related errors. Adrivefs.logfile will be created in the destination folder.
The tool will make a 1:1 copy of your cached DriveFS folder (if you don't use the --move option), but sorted by actual file extensions with their respective subfolders in the target folder. If the extension can't be recognized (usually happens with plain text files) or the file processing encounters an error, it will put the file in the Unspecified folder with no extension.
The tool is developed under the MIT license. You can freely use, modify, and redistribute this repository, given that you respect the given license.
You can freely contribute to this project by creating a Pull Request!

