Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to push/copy a single local file to specific remote directory? #612

Closed
kevjonesin opened this Issue Mar 28, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@kevjonesin
Copy link

commented Mar 28, 2016

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.]

@odeke-em

This comment has been minimized.

Copy link
Owner

commented Apr 2, 2016

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:

  1. drive copy only copies remote paths(files and directories) to the last specified path or if a single path is passed to drive copy, it will find the remote equivalent of the current working directory.
    Yes in deed, the documentation could definitely be improved.

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!

@kevjonesin

This comment has been minimized.

Copy link
Author

commented Apr 3, 2016

@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'.

@odeke-em

This comment has been minimized.

Copy link
Owner

commented Apr 3, 2016

Solid plan!

Am very busy mostly but I see a big need for this and I'll try to get this in pretty soon, and I'd be very happy to review documentation PRs. Thank you.

@odeke-em odeke-em added the enhancement label Apr 7, 2016

@odeke-em odeke-em added this to the v0.3.6 milestone Apr 7, 2016

@odeke-em odeke-em self-assigned this Apr 7, 2016

odeke-em added a commit that referenced this issue Apr 7, 2016

push: added --destination arbitrary within root pushes
Added the ability to push directly to a final destination
without copying content, remotely/locally nor moving, using
option `--destination`.

- Sample usage:

To push the content of `music/Travi$+Future`, `integrals/complex/compilations` directly to `a1/b2/c3`:

```shell
$ drive push --destination a1/b2/c3 music/Travi$+Future integrals/complex/compilations
```
where the sources exist on disk.

Fixes #612.

@odeke-em odeke-em closed this in #616 Apr 7, 2016

@odeke-em

This comment has been minimized.

Copy link
Owner

commented 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.
But basically now you can say

$ 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.
Let me know how it goes.

odeke-em added a commit that referenced this issue Apr 8, 2016

push/changes: keep track of local vs remote base
Keep track of the local vs remote base since we are no longer
only pushing from a single location on disk/local.
Also ensure that all paths in a push/changelist-resolve are
separator prefixed since searching for remote files always
starts with '/' as was the old style. Passing in say 'lib/f1'
is invalid since the search starts from '/' so must be '/lib/f1'.

Fixes #618
Updates #616
Updates #612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.