I have a media server that I backup using odrive. This server has 8 hard drives that I’ve joined together using a product that combines them all into a single volume totalling 49TB, but all files reside on one particular disk rather than being striped across all drives. It is however fairly random which disk they are on.
I recently had a single disk (4TB) fail and I purchased a new drive to replace it, now I want to resync the files from that drive to the new drive. When that drive was dropped from the volume odrive detected that about 4000 files were missing and added them to the trash. I need a way to restore all these items from the trash so I can sync them.
The only way I can find mentioned apart from restoring these files one by one is to unsync the top level folder. In my case though this isn’t a viable option, as the missing files are scattered among all the folders, I’d have to unsync and then resync 40+TB instead of just 4TB.
Is there a way to restore files from the trash apart from unsync/resync or spending hours restoring 4000 files one by one? Maybe with a CLI script?
Excellent feature request!
Today, I was looking for similar functionality. In this blogpost, @Tony explains that you can list the files that are currently in the trash. Since removed files are not placeholders, recovering with “sync” doesn’t work.
It would be really helpful if there would be a “recover” command in the CLI that takes the local location of the deleted file, and recovers it.
Hi @mandalorian2000 and @tulipit,
Unfortunately the CLI doesn’t support restoring items from trash.
I was messing around with this, though, and I think we can simulate a restore by manually creating the cloud files for the items that are listed in the trash. For example, if you have a listing of the files in the trash using the CLI, you can take a full path, append a .cloud (or .cloudf if its a folder) and create that placeholder file in that location.
On Mac you would use something like:
touch /Users/TheDude/odrive/Google Drive/myfile.txt.cloud
On Windows it would be something like:
echo "" > C:\Users\TheDude\odrive\Google Drive\myfile.txt.cloud
odrive should see this and remove the item from the trash listing, allowing you to sync that new placeholder.
Make sure you try it on a few files to make sure it provides the desired result, before you go crazy with a script
If it works, this would be an excellent workaround Tony! Thank you
Works like a charm
One obvious thing to keep in mind (and I forgot to do the first time):
Make sure that the original file will not be present in the folder. If it does live in the same folder, the odrive will automatically remove the .cloud file you’re trying to create.
Great! Thanks for the update @tulipit
Could you post the final script you used? I’m not super familiar with using scripts on windows.