How to upload files via CLI

I have viewed a number of posts around the CLI however in most cases they are talking about download (syncing) a file from their cloud provider, and not uploading. In all the post there is a comment that points to the following blog post:

https://medium.odrive.com/sync-client-magic-602d858731de

It talks about syncing a file; which for me is downloading it from Amazon Cloud Drive onto my local server. This therefore turns {filename}.cloudf to its original file. The question I have is how do you upload a file?

odrive backup test.txt ~/odrive-mount/Amazon\ Cloud\ Drive/test.txt

odrive is symlink’ed so that it points to the binary file; so when i run the above command I get:

Unable to add backup folder for: /root/test.txt. The remote path is invalid.

Unable to add backup folder for: /root/test.txt. The remote path is invalid.

How do i upload a file?

1 Like

Hi @michael4,
Uploads will happen automatically if you add or edit a file in the odrive mount.

For example, if you add the ~/odrive-mount/Amazon\ Cloud\ Drive/test.txt file, it will upload. You may have to issue a “refresh” (odrive refresh "~/odrive-mount/Amazon\ Cloud\ Drive/") to make sure odrive sees the change quickly, otherwise it could take ~15 minutes to pick-up, in some cases.

Oh perfect! I knew it was going to be easy!

I love the new CLI, but it would be great if you could document somewhere the methods to:

  • Mount - Completed
  • Sync files from odrive / cloud provider - Completed
  • Upload files to odrive / cloud provider - Not Completed
  • Advanced scripts - Completed

I have one last question how do you upload a file if I just want to put it straight into odrive with duplicating the file. For example:

Say I have a 10GB zip file on my server not in odrive, and I want to upload this to my cloud provider via odrive, but I don’t want to duplicate the file and store a second 10GB file in ~/odrive-mount.

How would this be complete? Is this the use case for stream odrive stream?

What would also be great is a quick explanation of each of the functions and an example command how to use them!

Hi @michael4,
Currently on the odrive Agent, the only way to upload without making a copy or moving it into the odrive folder is to create the Agent mount at the location you have the file. So, when you issue the mount command, the local target would need to be a folder that holds the file you want to upload. Correspondingly, you would select the appropriate remote folder for the target destination of the local folder.

If you are using the CLI on Windows or Mac, the premium feature “sync to odrive” can allow you to create several of these local to remote folder relationships. https://docs.odrive.com/docs/manage-sync#section-sync-external-folders