Move .cloud and .cloudf files with the CLI

cli
linux

#1

Today I moved a .cloud file from one folder to another. On a Mac when I do this, the file is moved by odrive. I am now running Linux, so have to use the cli tool. Once I moved the .cloud file, the only option to then sync this info is to do a odrive refresh . AFAIK. When I did that, my .cloud file was deleted. I’m not sure how best to proceed at this point, but ideally someone could tell me how to move .cloud files with the CLI and without having them be deleted.

nabeards


#2

As a follow-up: how do I restore a single item in the trash from the CLI?


#3

Hi @nabeards,
I haven’t been able to test this yet, but I think this may have to do with the order that odrive is seeing the operations. All moves are optimizations of a delete + add. odrive can only detect operations based on object states, so it has to interpret the intent for a move.

If you were to wait long enough, odrive will initiate its own routine local scan and pick up both the add and the delete for the placeholder file and be able to optimize that move. When you want it to be done immediately, you can issue the refresh on the folder where the file was moved from (odrive sees the file has been deleted), then a refresh on where the file was moved to (odrive will see the new placeholder and correlate it to the previous delete)

The CLI doesn’t have an individual restore command, but you can simulate a single restore by creating placeholder file where the file was deleted. For example, if you deleted /test/test.txt you can restore it with touch /test/test.txt.cloud. If it was a folder you would use .cloudf instead of .cloud.

Are you a premium user, or are you using the free version of odrive?


#4

Thanks @Tony,

I did try refreshing in both places, but the file is just gone. There’s a chance it’s in the Trash as somehow the parent folder is now in there, so I was hoping to just restore that entire folder.

Something definitely seems amiss with this use case. I am on the free odrive plan still, been a couple of years.

I tried your suggestion with the trash restore, but that doesn’t work. I touched the folder, Expenses.cloudf, then tried odrive sync Expenses.cloudf, which just gives me the error, Unable to sync Expenses.cloudf. This file doesn't exist.. However, it’s listed in the Trash at this path.

nabeards


#5

Hi @nabeards,

For the move using the Linux agent, the order would be like this:

  1. Move the file
  2. refresh the source folder path (where the file was moved from)
  3. refresh the destination folder path (where the folder was moved to) should be within 30 seconds of 2.

Alternatively, you can wait for odrive to pick it up itself, which can take up to 30 minutes.

For the simulated single restore action

  1. touch the placeholder file in the location where the file was deleted from
  2. refresh the parent folder
  3. Wait ~30 seconds

After the refresh, if you check the trash again the file should be removed and you should be able to sync that file now.

If following the above steps still doesn’t work, let me know and I’ll look into it further.


#6

@Tony
OK, was able to test the .cloud file move with your directions and it worked. Question: why does 3 need to be within 30 seconds of 2?? Sometimes I’m on extremely slow internet connections and can’t guarantee that.

I was able to restore a folder using the single restore action as well.

However, I will try to be more thorough in my note taking as things just seem very finicky in Linux. I currently have four .cloud files in a folder in Linux that don’t exist on my other computers at all as they were renamed and moved to a folder on another computer. Doing an odrive refresh . does not get rid of these, so what should I do??

nabeards


#7

Hi @nabeards,
The refresh command refreshes both local and remote. In this case is it the local we are concerned with. Basically odrive needs to know that the file that was in one location is now in another location, and it can’t do that without seeing the change in both locations. If you let odrive discover the move on its own when it routinely scans the local file system, it should pick it up on its own without needing to refresh. Manual refreshes are mostly used to trigger immediate action.

For the .cloud files that you see, are those files definitely gone in the cloud, as well? You can often see this behavior if the files were removed on one computer, odrive picked up the delete, but the odrive trash was not emptied, so the files still exist on the cloud. If you try to sync these files, what happens?


#8

Thanks @Tony!

I think I get the process now, it’s just definitely a lot more manual steps in Linux than macOS. Are there any plans to add better odrive integration in Wayland or another window manager for Linux?

Those files I mentioned are still in the cloud folder. I had actually confused them with different files that were renamed. So it appears all of my files are now back in the proper places. Thank you, as always, for your continued patience.

nabeards