On demand fuzzy find downloading (and perhaps uploading too?) #2752
Replies: 3 comments 1 reply
-
Now, I speak directly to you, abraunegg. I'm not going to ping you because I'm not sure if you'd get annoyed by that, so I guess I'll just have to hope you read this lol. What kind of functionality from what I showed above do you think would be feasible to implement natively in the OneDrive client that you created? I don't wanna run around raising feature requests like crazy. |
Beta Was this translation helpful? Give feedback.
-
As per my previous responses - please raise a feature request. I cant be clearer in how that is articulated to you .. My focus at the moment is delivery of v2.5.x and the major performance enhancement this brings. |
Beta Was this translation helpful? Give feedback.
-
@kalyanoliveira
Raise a bug report here: https://github.com/jstaf/onedriver/issues as that is probably a bug. The online file should be replaced with timestamps kept ... but OneDrive Account Types + Graph API do odd things - for example Personal Accounts act totally different to Business Accounts for timestamp keeping, then there is the whole SharePoint debacle where Microsoft will modify your file post upload changing not only the timestamp, but adding data to your file - thus your integrity of that file is gone. Please read OneDrive/onedrive-api-docs#935 for details.
|
Beta Was this translation helpful? Give feedback.
-
This discussion follows the two previous questions (here and here) that I posted in the Discussions section of abraunegg/onedrive.
I'm just looking for a specific way of accessing my OneDrive files, really.
Here's the kind of behavior that I'm after: on-demand (command-line) fuzzy finding of my files, and the power for me to determine exactly how and when my files are uploaded/downloaded.
jstaf/onedriver currently checks the on-demand functionality checkbox that I'm after, and its great. With
tmux
, I can keep it running in the background (though that's not necessarily the only way to achieve that) with something like:With
fd
, I can$ fd . /onedriver/mount/path/here
to forceonedriver
to cache the paths of all files that I currently have in OneDrive. It took around 3 minutes forfd
to find all of my 19,000 files that currently live in my OneDrive and cache their paths.onedriver
checks in with OneDrive every 30 seconds; any changes simply get "appended" to the cached state, which is why every subsequent call tofd
is almost always instant. If I happen to closeonedriver
, though, I will have to wait around for those 3 minutes to re-obtain that cached state.Then, I can simply pipe
fd
's output tofzf
for fuzzy finding with$ fd . /onedriver/mount/path/here | fzf
, and fuzzy find all of my OneDrive files.That's progress, but I have only achieved fuzzy finding across the paths of my OneDrive files. Nothing ever gets downloaded or uploaded, though we do have some of the puzzle pieces to achieve that kind of behavior.
onedriver
generally works in the following manner:Emphasis on that second rule. To download the latest version of a file from OneDrive with
onedriver
, you simply have to open it (e.g.,nvim /onedriver/mount/path/here/plus/path/to/file
). Butonedriver
is not a sync client; when you save the file you just downloaded (presumably after making some changes to it),onedriver
deletes the OneDrive version of that file, and uploads your own local copy. In this process (for some reason), creation timestamps of files get lost. And I don't like that.However, files downloaded by
onedriver
and uploaded byonedrive
do maintain their creation timestamps. Hence, I propose the following workaround:onedriver
(or just download stuff normally with$ onedrive --synchronize
)$ onedrive --synchronize
strictly, perhaps disposing of command line options like--single-directory <dir>
,--upload-only
, and--no-remote-delete
.Here's a stupidly simple bash script that does the first part, using
fzf
andfd
:Make that script available in somewhere in your
$PATH
, and use something liketmux new-window <script-name-here>
to on-demand, fuzzy-find download your OneDrive files. Great! You could add some error checking to make sure thatonedriver
is actually mounted to/path/to/onedriver/mountpoint/here
and all that, but that comes later.For the second part, I suppose I could also write a wrapper script around
$ onedrive --synchronize --single-directory <dir> --upload-only --no-remote-delete
to achieve a--single-file
-like bevavior, but that's not an immediate concern for me at the moment.Anyways,
and I more or less achieved that. Though some native on-demand functionality for
onedrive
, the ability tols
your OneDrive folder withonedrive
, and some way to specify files instead of folder to sync would be nice.If anyone has any suggestions to this workaround, let me know. This was my first time messing around with
tmux
and bash scripting, so I'm certainly still a beginner and learning.Beta Was this translation helpful? Give feedback.
All reactions