Join GitHub today
Is there a way to push/copy a single local file to specific remote directory? #612
Is there a way to push/copy a single local file to specific remote directory? I didn't find any way in "help" docs to specify a remote path or otherwise change remote target directory with "drive push" commands for a single file. And "drive cp" appears to be just for copying remote files to ... well, the "help" docs don't actually specify, but I'm presuming a local path ... or is it to make additional copies within remote directories? I was able to push a file from my local "~/gdrive" directory to my Google Drive's root directory ('My Drive') with "drive push file.txt" and then use "drive mv file.txt Foo/Directory/" to relocate it, but I'm left wondering if there is a way to place a local file of choice in remote directory of choice with a single command? At present, I'm just looking to manually move occasional files to and from my Google Drive via command line, rather than fully syncing remote and local directories.
[BTW, thanks for maintaining and developing "drive"; it's nice to have some GDrive access when I don't have a GUI at hand.]
Hello @kevjonesin. Thank you for the question and welcome to drive! My apologies for the late reply.
So to push a single file to a specific path is a bit awkward for now, yes in deed. A copy then move doesn't suffice. No one had needed this functionality in the past so I never thought of it. But this is def a good feature to add that will make it easy to move things as opposed to push by relocating to the exact directory structure.
To answer some questions:
However for now, you'd have to recreate the directory structure of the target path so
$ cp content a1/b2/c3 $ drive push a1/b2/c3 # Or cd a1/b2/c3 && drive push
But as you already noticed that quickly becomes unuseable and too much hacking. Thanks for the request, PR coming soon!
@odeke-em, Thanks for your response and consideration. : }
p.s.— I might be able to find time (at some point) to help with documentation. Perhaps expand upon current "help" entries and migrate them to a traditional "man" page and/or "info" page. Would be an interesting way to learn 'man page' format and syntax. win/win
Oh, and it occurs to me that basically the functionality I was looking for would pretty much be 'drive' equivalents of "put" and "get" as used with 'sftp'. So, for user familiarity, "put" and "get" might be good command names if you do go ahead and add such arbitrary file handling to 'drive'.
referenced this issue
Apr 7, 2016
Hello @kevjonesin thanks for the patience. This issue was auto-closed from a PR commit. Please feel free to reopen it if the problem persists.
$ drive push --destination a1/few/ones allSources/b2/b3/b5 b8n/logs content/locks/bz9
where the arguments after you've specified the push destination should exist relative to the root of the mounted root dir.