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

Ability to skip symbolic links? #87

Closed
leifdenby opened this issue Jul 27, 2018 · 6 comments
Closed

Ability to skip symbolic links? #87

leifdenby opened this issue Jul 27, 2018 · 6 comments

Comments

@leifdenby
Copy link

Is your feature request related to a problem? Please describe.
I have quite a lot of large files that I don't want to add to my OneDrive that are stored in a separate disk on my machine. To access the files in my terminal I simple symlink them into directories which contains analysis scripts that I want to sync to OneDrive.

Describe the solution you'd like
Ability to simply skip symlinks. Either these would appear as symlinks once synced to OneDrive (although I'm not sure if OneDrive supports "shortcuts" like this?) or otherwise just skipped altogether.

Describe alternatives you've considered
The current alternative I use is to skip files with file extension that matches the large files I want to skip, but that doesn't avoid all the other files in the symlinked directories being synced. I could also add every symlinked directory that I don't want to sync to the config file, but this will be quite laborious. Another option would be to support a sort of .onedriveignore file with the same syntax as git.

Additional context
n/a

@leifdenby
Copy link
Author

I would be happy to contribute development to this myself, but I am unfamiliar with D. If you could point me to the source code which determines which files to sync I could try and add this myself. I had a quick search for "filter" and "skip" in the source code but couldn't find anything.

Also, thank you for keeping this project alive!

@abraunegg
Copy link
Owner

Thanks for the feature request.

The simplest way to achieve this would be, in main.d add a new flag that can be used by sync.d, that if set, the symbolic link is skipped in private void uploadNewItems

Line 936 in sync.d currently checks to make sure a symbolic link is valid. What you could do before this iss check if your new flag is set to skip path if it is a symbolic link before the checks validating the path are done.

Line 938 should also read Skipping item - invalid symbolic link not Skipping item - symbolic link - will have to fix that.

@abraunegg abraunegg added In Progress Currently being worked on and removed Future Work - Planning Required labels Aug 1, 2018
abraunegg pushed a commit that referenced this issue Aug 2, 2018
* Add ability to skip symlinks
@abraunegg abraunegg added Fixed and removed In Progress Currently being worked on labels Aug 2, 2018
@abraunegg
Copy link
Owner

PR #92 merged which implements this feature

@leifdenby
Copy link
Author

@abraunegg I just realised that I should really skip symlinked files when using the "monitor" command too. I was thinking of adding adding in similar checks on https://github.com/abraunegg/onedrive/blob/master/src/monitor.d#L65 and https://github.com/abraunegg/onedrive/blob/master/src/monitor.d#L166.

What do you think?

@abraunegg
Copy link
Owner

monitor.d essentially sets up all the inotify flags, however the main code where the changes were made is still run regardless of monitor mode or manual sync. By adding in changes to monitor.d, all that would happen would be no inotify watch be created on a symbolic link. In doing that there could be an 'incremental' performance boost by not adding an inotify watch to a symlink if it is manually going to be excluded during the sync process - so potentially worth doing.

@lock
Copy link

lock bot commented Jan 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Jan 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants