Code Monkey home page Code Monkey logo

drivesync's Introduction

DriveSync

v 1.4.0

A command line utility that synchronizes your Google Drive files with a local folder on your machine. Downloads new remote files, uploads new local files to your Drive and deletes or updates files both locally and on Drive if they have changed in one place. Allows blacklisting or whitelisting of files and folders that should not / should be synced.

Works as a replacement for the Google Drive client for Windows and Mac

Installation

Please note that the pre-packaged version has been removed because Travelling Ruby stopped being maintained, causing some SSL issues.

Requires Ruby >= 2.0. If Ruby isn't installed on your system, get it through rvm or install it yourself with your distro's package manager.

When Ruby is installed, get drivesync:

git clone https://github.com/MStadlmeier/drivesync.git
cd drivesync
bundle install

You can then run DriveSync with ruby drivesync.rb

Updates

The easiest way to get the latest version is by going in the directory that contains drivesync.rb and running git pull . DriveSync checks for updates whenever it starts and notifies you if there is a new version. However, users that automate DriveSync may not see this notice, so I suggest checking this site occasionally or running ruby drivesync.rb -v to check for updates.

Configuration

There is a config file located in ~/.drivesync/config.yml containig all of DriveSync's settings. This file can also be edited directly with ruby drivesync.rb config . The settings are explained in the config file. For now, the most important option is the location for the drive folder on your local system. Set it to where you would like your local drive to be.

Automating DriveSync

Make sure to run DriveSync manually at least once after you install it, as it will ask you to authenticate.

Ideally, you shouldn't have to sync your Drive manually, so let's run DriveSync periodically as a Cronjob. To do this, edit your crontab with crontab -e and add a Cronjob.

*/1 * * * * ruby /path/to/drivesync/drivesync.rb

If you use rvm to manage your Ruby installations, you may need to run rvm cron setup before you can use ruby in Cronjobs

This will attempt to run DriveSync every minute. If DriveSync is started, but a sync is already in progress then the program will terminate and let the sync finish. You can also redirect the software's output into a log file so you can keep track of what is being synced or any errors that might occur: ruby path/to/drivesync/drivesync.rb > /tmp/drivesync.log

Large files

Personally, I wouldn't advise automatically syncing "large" (anything in the several hundred MB range) files between platforms with this or any other software. By default, DriveSync will ignore any file above 512 MB but this can be changed in the config file. If you do this, you may have to increase the timeout threshold which can also be done in the config file.

Troubleshooting

If you encounter any difficulties, feel free to open an issue here and I'll get to you as soon as possible. Alternatively, running ruby drivesync.rb reset will reset your installation and clear your local drive folder, which might also help.

Known Issues

  • The Google Drive filesystem allows folders or files with identical paths, while common Linux filesystems do not. I strongly advice against having multiple files with identical paths on Drive (for example a folder with two files called foo.txt).

  • Currently, DriveSync ignores Google Docs files (documents, presentations, spreadsheets, etc). In the future, these files might be "downloaded" as links to the corresponding files on Drive.

  • Folders are not deleted remotely if they are deleted locally. The contents will be deleted, however.

Disclaimer

Neither I nor this software are in any way affiliated with Google. Although I tested this software very thoroughly and have been using it myself for over a year without any loss of data, you agree to use DriveSync at your own risk and I am not responsible for any damages that may occur.

drivesync's People

Contributors

minuq avatar muniftanjim avatar p4l1ly avatar tiekookeit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drivesync's Issues

Move configuration to .config

Hi !

Is it possible to move the configuration to the folder .config and then to have ~/.config/drivesync/config.yml ?

Thank you

Is it possible to use two different versions of drivesync for two different google accounts?

In the src, it looks like I can easily change the credentials file and the configuration folder. Can I also change the name of drivesync in the src, and then create two applications, (1) drivesync (for the original Google account) and (2) Xdrivesync (for the second Google account)? Or do I not even need to change the name, but instead just run the program from within two different folders?

I am NOT a programmer, so I may completely misunderstand what is going on!

Server error when uploading thousends of small files

Hi, I'm using drivesync to upload (~750000) file to my google drive, but every hundreds file the app stops with an error.
each file is about 160 KB only, my google drive have a large empty space more than what I need.
I'm using Ubuntu 20.04.02

Uploading file project/cropped_nodules/358094.npy ...
Traceback (most recent call last):
23: from drivesync.rb:64:in <main>' 22: from drivesync.rb:23:in sync'
21: from /home/mustafa/drivesync/src/synchronizer.rb:71:in run' 20: from /home/mustafa/drivesync/src/synchronizer.rb:279:in sync'
19: from /home/mustafa/drivesync/src/synchronizer.rb:279:in each' 18: from /home/mustafa/drivesync/src/synchronizer.rb:282:in block in sync'
17: from /home/mustafa/drivesync/src/synchronizer.rb:166:in upload_file' 16: from /home/mustafa/drivesync/src/drive_manager.rb:116:in upload'
15: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:601:in create_file' 14: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in execute_or_queue_command'
13: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:93:in execute' 12: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
11: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in times' 10: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
9: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:101:in block in execute' 8: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
7: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in times' 6: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
5: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:104:in block (2 levels) in execute' 4: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/upload.rb:246:in execute_once'
3: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/upload.rb:170:in process_response' 2: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:183:in process_response'
1: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/api_command.rb:118:in check_status' /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:221:in check_status': Server error (Google::Apis::ServerError)

Missing log files

Hi, I wondering this app, but I miss some king of log file, like diff output, to show what is running in background, wich files are synced locally and wich files are synced remotely. Thanks.

Suddenly `check_status': notFound: File not found

I saw that the script doesn't sync anymore files. I noticed that it keep running background using a lot of CPU (around 50-100% of my raspberry) then it stops after 1 minute (some times 3-4 minutes) without give any error or printing some info about sync. I thought the authorization was broken and it keep retrying to connect to the google's api.
I removed the ~/.credentials/drivesync.yaml and created a new authorization token, but now I got this error:

/var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:218:in `check_status': notFound: File not found: 1QyyQUEJnFpY9dUUnCENSORED. (Google::Apis::ClientError)
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/api_command.rb:116:in `check_status'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:183:in `process_response'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:299:in `execute_once'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:104:in `block (2 levels) in execute'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:101:in `block in execute'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
	from /var/lib/gems/2.3.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:93:in `execute'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:792:in `get_file'
	from /opt/drivesync/src/drive_manager.rb:152:in `get_folder'
	from /opt/drivesync/src/drive_manager.rb:142:in `resolve_path'
	from /opt/drivesync/src/drive_manager.rb:87:in `block in get_files'
	from /opt/drivesync/src/drive_manager.rb:87:in `each'
	from /opt/drivesync/src/drive_manager.rb:87:in `get_files'
	from /opt/drivesync/src/synchronizer.rb:85:in `get_files'
	from /opt/drivesync/src/synchronizer.rb:66:in `run'
	from /opt/drivesync/drivesync.rb:23:in `sync'
	from /opt/drivesync/drivesync.rb:64:in `<main>'

Is this a problem of google's api?

cannot load such file -- rubygems.rb

I am running Arch Linux. Whenever I try to run drivesync I get the following error

Traceback (most recent call last):
	1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': cannot load such file -- rubygems.rb (LoadError)

possible data lost

Hello!

If datasync interrupted before first sync is finished (with ctrl+c) next start will start delete files remotely (from google drive).

Not sync shared drive

If google drive has additional shared drives his not synced.
Synced only files in MyDrive folder.

bundle install throws an error

i do the first few steps(install ruby, git clone the repo)
and then when i run " bundle install "
it throws this error " google-api-client-0.23.4 requires ruby version ~> 2.0, which is incompatible with the
current version, ruby 3.0.2p107
"

Drivesync stopped working : "cannot load such file -- google/apis/drive_v3 (LoadError)"

Hi,

I use drivesync on two different machines, both running Archlinux, and recently they both got this error when launching ruby drivesync.rb (both used to work perfectly fine before) :

ruby drivesync/drivesync.rb  ✔  14:46:34 
internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require': cannot load such file -- google/apis/drive_v3 (LoadError) from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from /home/tromzy/drivesync/src/synchronizer.rb:1:in <top (required)>' from drivesync/drivesync.rb:1:in require_relative'
from drivesync/drivesync.rb:1:in `

'

What should I do ?

Doesn't sync

Authenticated fine, but no files are syncing. Just happily sits there doing nothing... no output, no files. Exits gracefully on ctrl-c.

can't reauthorize Google Drive access

From drive.google.com, settings > manage apps > drivesync > disconnect from drive.
Natually, drivesync no longer has access to my account, but I don't see any way to request that authorization again.

Crash during Suspend/Resume cycle

Hello!

Here is a crash during initial sync with syspend resume.

Downloading file .encfs/NmrQM-ZiuEslkdRee437XXTB/J-K6K3ee9gtpdjA4n1nbzJkRRTEqxCcQWoqBotn4FXTHN,/i805m1NMpytudSkYE2QMAaloaLFKnfK9NKCjaJPyWNekF-/Lg0Rzs858ZPG2DKke7BKdl6J/c-qluFY6bppY3l7bTqK9qnpy/HpbXdxf0QF1gAyBtEY1ySmSo/YHstEBlucUbgxM-UdgaZj6gjX2G-E7upS3CxI3yflUImTuqBDLueHKh0UkE9denuln8 ...
Traceback (most recent call last):
	36: from /home/axet/local/drivesync/drivesync.rb:64:in `<main>'
	35: from /home/axet/local/drivesync/drivesync.rb:23:in `sync'
	34: from /home/axet/local/drivesync/src/synchronizer.rb:71:in `run'
	33: from /home/axet/local/drivesync/src/synchronizer.rb:267:in `sync'
	32: from /home/axet/local/drivesync/src/synchronizer.rb:267:in `each'
	31: from /home/axet/local/drivesync/src/synchronizer.rb:270:in `block in sync'
	30: from /home/axet/local/drivesync/src/synchronizer.rb:151:in `download_file'
	29: from /home/axet/local/drivesync/src/drive_manager.rb:99:in `download'
	28: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:792:in `get_file'
	27: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
	26: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:93:in `execute'
	25: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
	24: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
	23: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
	22: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:101:in `block in execute'
	21: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
	20: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
	19: from /var/lib/gems/2.5.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
	18: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:104:in `block (2 levels) in execute'
	17: from /var/lib/gems/2.5.0/gems/google-api-client-0.23.4/lib/google/apis/core/download.rb:77:in `execute_once'
	16: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:743:in `get'
	15: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:854:in `request'
	14: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1104:in `follow_redirect'
	13: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
	12: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
	11: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
	10: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1245:in `do_get_block'
	 9: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient.rb:1299:in `do_get_header'
	 8: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:561:in `get_header'
	 7: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:784:in `read_header'
	 6: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:801:in `parse_header'
	 5: from /usr/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
	 4: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:805:in `block in parse_header'
	 3: from /var/lib/gems/2.5.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:62:in `gets'
	 2: from /usr/lib/ruby/2.5.0/openssl/buffering.rb:207:in `gets'
	 1: from /usr/lib/ruby/2.5.0/openssl/buffering.rb:57:in `fill_rbuff'
/usr/lib/ruby/2.5.0/openssl/buffering.rb:57:in `sysread': execution expired (Google::Apis::TransmissionError)

Syncing files shared with me and added to My Drive

I'm just getting started with DriveSync -- I noticed that it doesn't sync things which have been shared with me that I've added to My Drive:

folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}
@files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}

Is there a way to sync things I don't own but are in My Drive?

Could not write lock file!

I'm trying to run ruby drivesync.rb but comes ERROR : Could not write lock file!
I have tried search on Google what's causing this problem but didn't found the solution
I don't know this is drivesync related or terminal related
I'm using termux on Android

Sync takes a long time

When I run ruby drivesync.rb, the console will hang for about 5 minutes before outputting the "Sync complete." message, even if everything is already synced. Is this normal?

Here's an example, I first print the time to show you how long the sync takes:

$ date "+%H:%M:%S"; ruby drivesync.rb
17:39:34
Local folder is 0 files behind and 0 files ahead of remote
Starting sync at 2019-09-13 17:44:19 -0400

Sync complete.

I've only used less than 50MB of the drive space.

Similar to other error messages

Drivesync works fine. For many months, these four error messages have appeared:

  1. /home//bin/drivesync/drivesync.rb:11: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
  2. /var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: `_1' is reserved for numbered parameter; consider another name
  3. /var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: `_2' is reserved for numbered parameter; consider another name
  4. /var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: `_3' is reserved for numbered parameter; consider another name

I use the unstable Debian kernel, which tomorrow might be different, but today is: 10.0-3-amd64 #1 SMP Debian 5.10.13-1 (2021-02-06) x86_64 GNU/Linux.

Ruby is version 1:2.7+2. I don't know what version ruby-gems is, because it was not installed from the distro's repository.

There are no performance problems. Thank you for creating Drivesync!

Error when trying to run it for the first time

Hello, does anyone know how to fix this issue?, thanks in advance

cesar@cesar-HP-Compaq-Pro-6300-SFF:~/drivesync$ ruby drivesync.rb
Local folder is 168 files behind and 73 files ahead of remote
Traceback (most recent call last):
5: from drivesync.rb:64:in <main>' 4: from drivesync.rb:23:in sync'
3: from /home/cesar/drivesync/src/synchronizer.rb:68:in run' 2: from /home/cesar/drivesync/src/synchronizer.rb:224:in load_manifest'
1: from /usr/lib/ruby/2.5.0/json/common.rb:156:in parse' /usr/lib/ruby/2.5.0/json/common.rb:156:in parse': 765: unexpected token at '' (JSON::ParserError)

Correct Directory structure for Whitelist/Blacklist ?

What is the correct structure for enforcing Whitelist/Blacklist ? I tried Blacklist["/FolderA", "/FolderB"] , if Folder A and Folder B are in the root directory of my drive ?
And also how do we exclude/include folders in Computers in the left section ?

Warning Kernel.open

After syncing, I got this warning:

drivesync.rb:11: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open

--
OS: Ubuntu 20.04 LTS x86_64
Kernel: 5.4.0-39-generic
DE: GNOME

Seemingly random "Invalid request" errors

I've tried multiple times now to use this program, but when I use an already filled, but slightly outdated local Google Drive folder as the path to sync to, it thinks that that is the latest state and starts deleting files remotely. But when I start with an empty folder, then it downloads for a while, last time it was 2-3 hours, then gives the following error message:

/var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/http_command.rb:211:in `check_status': Invalid request (Google::Apis::ClientError)
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/api_command.rb:102:in `check_status'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/download.rb:94:in `execute_once'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/http_command.rb:107:in `block (2 levels) in execute'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/http_command.rb:104:in `block in execute'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
	from /var/lib/gems/2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/http_command.rb:96:in `execute'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/lib/google/apis/core/base_service.rb:351:in `execute_or_queue_command'
	from /var/lib/gems/2.3.0/gems/google-api-client-0.9.20/generated/google/apis/drive_v3/service.rb:772:in `get_file'
	from /home/fabian/Desktop/programs/drivesync-master/src/drive_manager.rb:92:in `download'
	from /home/fabian/Desktop/programs/drivesync-master/src/synchronizer.rb:132:in `download_file'
	from /home/fabian/Desktop/programs/drivesync-master/src/synchronizer.rb:251:in `block in sync'
	from /home/fabian/Desktop/programs/drivesync-master/src/synchronizer.rb:248:in `each'
	from /home/fabian/Desktop/programs/drivesync-master/src/synchronizer.rb:248:in `sync'
	from /home/fabian/Desktop/programs/drivesync-master/src/synchronizer.rb:76:in `run'
	from /home/fabian/Desktop/programs/drivesync-master/drivesync.rb:23:in `sync'
	from /home/fabian/Desktop/programs/drivesync-master/drivesync.rb:58:in `<main>'

When I then try to start the program again, it starts deleting files remotely, because it thinks that the local folder is correct.

Another Conversion error (\\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError))

First of all, I love drivesync! It does everything I want.
But when I want to sync my files, some german letters (ä,ü,ö etc) cause some conversion errors.

Uploading file SchuleAktuellZorin/Bio/Ökosysteme/ÖkosystemFließgewässer.pdf.xopp ...
/home/USER/.rvm/gems/ruby-2.7.0/gems/multi_json-1.13.1/lib/multi_json/options_cache.rb:12:_ warning: Capturing the given block using Proc.new is deprecated; use &block instead
Traceback (most recent call last):
20: from drivesync.rb:65:in <main>' 19: from drivesync.rb:24:in sync'
18: from /home/katlem/drivesync/src/synchronizer.rb:71:in run' 17: from /home/katlem/drivesync/src/synchronizer.rb:279:in sync'
16: from /home/katlem/drivesync/src/synchronizer.rb:279:in each' 15: from /home/katlem/drivesync/src/synchronizer.rb:282:in block in sync'
14: from /home/katlem/drivesync/src/synchronizer.rb:166:in upload_file' 13: from /home/katlem/drivesync/src/drive_manager.rb:108:in upload'
12: from /home/katlem/drivesync/src/drive_manager.rb:178:in traverse_and_create' 11: from /home/katlem/drivesync/src/drive_manager.rb:178:in each'
10: from /home/katlem/drivesync/src/drive_manager.rb:181:in block in traverse_and_create' 9: from /home/katlem/drivesync/src/drive_manager.rb:167:in create_folder'
8: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:601:in create_file' 7: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in execute_or_queue_command'
6: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:91:in execute' 5: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/google-api-client-0.23.4/lib/google/apis/core/api_command.rb:64:in prepare!'
4: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/representable-3.0.4/lib/representable/json.rb:44:in to_json' 3: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/multi_json-1.13.1/lib/multi_json.rb:139:in dump'
2: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:25:in dump' 1: from /home/katlem/.rvm/gems/ruby-2.7.0/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:21:in dump'
/home/katlem/.rvm/gems/ruby-2.7.0/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:21:in `to_json': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

I have not changed anything else in the code and when I rename the file, the syncing works without problems.
I resently changed distros from ubuntu based, where everything worked fine, to an Arch based, and kept the home directory (if that is useful)

Thanks in advance for anything! If some more files or more information is needed i'l provide them as quickly as I can!

Error uploading files

This has been working flawlessly for months (thank you). Did Google change their API or something?

Uploading file Classroom/Physical Science 10 Spring 2023/notes/7D Periodic Trends.pdf ...
/home/xxx/software/drivesync/src/drive_manager.rb:158:in `block in folder_with_name': undefined method `first' for nil:NilClass (NoMethodError)
        from /home/xxx/software/drivesync/src/drive_manager.rb:158:in `select'
        from /home/xxx/software/drivesync/src/drive_manager.rb:158:in `folder_with_name'
        from /home/xxx/software/drivesync/src/drive_manager.rb:180:in `block in traverse_and_create'
        from /home/xxx/software/drivesync/src/drive_manager.rb:178:in `each'
        from /home/xxx/software/drivesync/src/drive_manager.rb:178:in `traverse_and_create'
        from /home/xxx/software/drivesync/src/drive_manager.rb:108:in `upload'
        from /home/xxx/software/drivesync/src/synchronizer.rb:166:in `upload_file'
        from /home/xxx/software/drivesync/src/synchronizer.rb:282:in `block in sync'
        from /home/xxx/software/drivesync/src/synchronizer.rb:279:in `each'
        from /home/xxx/software/drivesync/src/synchronizer.rb:279:in `sync'
        from /home/xxx/software/drivesync/src/synchronizer.rb:71:in `run'
        from drivesync.rb:23:in `sync'
        from drivesync.rb:64:in `<main>'

ASCII-8BIT to UTF-8 Encoding::UndefinedConversionError

I run drivesync in a official ruby:2.6.6 docker container, see dockerfile

During downloading files from google drive to my local host, drivesync sometimes fail while processing a file with a special character, see two examples below:

file name: Bokningsbekräftelse/Kvitto.pdf
special character: ä UTF-8: \xc3\xa4

Updating file Aimer39V1.0.0.pdf ...
Uploading file Bokningsbekräftelse/Kvitto.pdf ...
Traceback (most recent call last):
        21: from drivesync.rb:64:in `<main>'
        20: from drivesync.rb:23:in `sync'
        19: from /drivesync/src/synchronizer.rb:71:in `run'
        18: from /drivesync/src/synchronizer.rb:279:in `sync'
        17: from /drivesync/src/synchronizer.rb:279:in `each'
        16: from /drivesync/src/synchronizer.rb:282:in `block in sync'
        15: from /drivesync/src/synchronizer.rb:166:in `upload_file'
        14: from /drivesync/src/drive_manager.rb:108:in `upload'
        13: from /drivesync/src/drive_manager.rb:178:in `traverse_and_create'
        12: from /drivesync/src/drive_manager.rb:178:in `each'
        11: from /drivesync/src/drive_manager.rb:181:in `block in traverse_and_create'
        10: from /drivesync/src/drive_manager.rb:167:in `create_folder'
         9: from /usr/local/bundle/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:601:in `create_file'
         8: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
         7: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:91:in `execute'
         6: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/api_command.rb:64:in `prepare!'
         5: from /usr/local/bundle/gems/representable-3.0.4/lib/representable/json.rb:44:in `to_json'
         4: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json.rb:139:in `dump'
         3: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:25:in `dump'
         2: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `dump'
         1: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `to_json'
/usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `encode': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

file name: 1980 12 Sacré Coeur 5.jpg
special character: é UTF-8: \xc3\xa8

Updating file Google Foto's/2008/01/1977 7 12half  jaar.jpg ...
Downloading file Google Foto's/2008/01/1977 8 12half jaar.jpg ...
Uploading file Google Foto's/2008/01/1980 12 Sacré Coeur 5.jpg ...
Traceback (most recent call last):
        19: from drivesync.rb:64:in `<main>'
        18: from drivesync.rb:23:in `sync'
        17: from /drivesync/src/synchronizer.rb:71:in `run'
        16: from /drivesync/src/synchronizer.rb:279:in `sync'
        15: from /drivesync/src/synchronizer.rb:279:in `each'
        14: from /drivesync/src/synchronizer.rb:282:in `block in sync'
        13: from /drivesync/src/synchronizer.rb:166:in `upload_file'
        12: from /drivesync/src/drive_manager.rb:116:in `upload'
        11: from /usr/local/bundle/gems/google-api-client-0.23.4/generated/google/apis/drive_v3/service.rb:601:in `create_file'
        10: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
         9: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/http_command.rb:91:in `execute'
         8: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/upload.rb:141:in `prepare!'
         7: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/upload.rb:51:in `prepare!'
         6: from /usr/local/bundle/gems/google-api-client-0.23.4/lib/google/apis/core/api_command.rb:64:in `prepare!'
         5: from /usr/local/bundle/gems/representable-3.0.4/lib/representable/json.rb:44:in `to_json'
         4: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json.rb:139:in `dump'
         3: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:25:in `dump'
         2: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `dump'
         1: from /usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `to_json'
/usr/local/bundle/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:19:in `encode': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

To resolve this (each time a file name contains a special character) I need to:

  • rename the file name in my google drive (to some name without a special character)
  • rename the file name in the manifest file.
  • rename the file name on my local machine.
  • restart drivesync

I think my docker container supports UTF-8, because I am able to rename the files from inside the container:

[root@i7nuc Docker-Linux-sync-Google-Drive]# podman run -it \
  -v /mnt/extdisk/googledrive:/root/Documents/drive:z localhost/google-drivesync /bin/bash 

root@12303cbbee3c:/drivesync# mv "/root/Documents/drive/Google Foto's/2008/01/1980 12 Sacré Coeur 5.jpg"  "/root/Documents/drive/Google Foto's/2008/01/1980 12 Sacre Coeur 5.jpg" 

root@12303cbbee3c:/drivesync# ls -l "/root/Documents/drive/Google Foto's/2008/01/1980 12 Sacre Coeur 5.jpg"
-rw-r--r--. 1 root root 801428 May 27 12:24 "/root/Documents/drive/Google Foto's/2008/01/1980 12 Sacre Coeur 5.jpg"

My locale setting inside the container:

root@12303cbbee3c:/drivesync# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

What can I do to resolve this? (I have no experience with Ruby).

First time use error...

Installed drivesync on osx, after installing Ruby 2.6.x using homebrew. I understand that I need to create the config.yml file by running drivesync.rb, but when I do, I get the following. Any possible guidance? Thanks!

ruby drivesync.rb
Traceback (most recent call last):
	4: from drivesync.rb:1:in `<main>'
	3: from drivesync.rb:1:in `require_relative'
	2: from /Users/sstromer/Applications/GitHub/drivesync/src/synchronizer.rb:1:in `<top (required)>'
	1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- google/apis/drive_v3 (LoadError)

Google OAuth Error 400: Invalid request

Hello,

authorization URL printed in the terminal leads to an error 400: invalid request, which is shown by a Google OAuth login site:

The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow migration guide linked in the developer docs below to migrate your app to an alternative method.
Request details: redirect_uri=urn:ietf:wg:oauth:2.0:oob 

As far as I can read here and here, authentication method used by drivesync is deprecated now.

Issue with access token after 2 days works

/usr/local/rvm/gems/ruby-2.6.3/gems/signet-0.8.1/lib/signet/oauth_2/client.rb:988:in `fetch_access_token': Authorization failed. Server message: (Signet::AuthorizationError)
{
"error": "invalid_grant",
"error_description": "Token has been expired or revoked."
}

Google thirdy part app not secure

Hi,
I'm using your very userful tool for backup my database dumps into the gdrive space.
Starting from 1 month, it seems that nothing works 'cause "authorization denied".
I checked into the Google Account, and I see that "enable not secure app" was disabled.
I reactivated it, but when I try to obtain a new token, Google says me that it's not possible.
Do you know something about it? Is there a chance to use your tool with "secure app" feature?

Thanks,
Mariano

Symlinked directory doesn't sync

I've the following symlinked directory:

[munif:~/data/Drive] $ ls -l
lrwxrwxrwx 1 munif munif   33 Oct 26 14:03 documents -> /home/ubuntu/munif/data/documents

/home/ubuntu/munif/data/documents directory has many files and folders inside it.

I created an empty folder named documents on my Google Drive.

When I run drivesync, nothing happens.

Dropbox's Linux client follows symlinks. It'd be nice to have this feature in DriveSync.

Exceptions to blacklist

I have a directory /foo that I want drivesync to mostly ignore, but there are some subfolders /foo/bar and /foo/baz I want to still be included.

From the readme, it seems like there's no way to do this currently. If that's the case, I think it would be very helpful to add some way of doing this.

NoMethodError in synchronizer.rb

I'm running from the bundled package. When I first manually ran the program it did sync some files to my local directory, then appeared to stop after a few minutes. I ran it manually again and got the following output:

$ ./drivesync

Local folder is 1576 files behind and 0 files ahead of remote
Starting sync at 2017-12-04 18:51:39 -0600
/home/thomas/Downloads/drivesync-linux-x86_64-v_1.2/lib/app/src/synchronizer.rb:127:in 'block in sync': undefined method '[]' for nil:NilClass (NoMethodError)
from /home/thomas/Downloads/drivesync-linux-x86_64-v_1.2/lib/app/src/synchronizer.rb:124:in 'each'
from /home/thomas/Downloads/drivesync-linux-x86_64-v_1.2/lib/app/src/synchronizer.rb:124:in 'sync'
from /home/thomas/Downloads/drivesync-linux-x86_64-v_1.2/lib/app/src/synchronizer.rb:228:in 'run'
from /home/thomas/Downloads/drivesync-linux-x86_64-v_1.2/lib/app/drivesync.rb:4:in '<main>'

Folders are only synchronized when a file is added to it; Folders are not deleted

First off, thanks for all the hard work on this project, I am really loving it.

If I create a new folder with no content (either locally or via the Drive web client) the folder is not synchronized. Once I ad a file to the folder, it will synchronize. Additionally, deleting a folder (either from the cloud or from the local client) doesn't synchronize. The contents will be deleted, but the folder structure will remain.

I am running 1.3.3 on Debian 9.4 and ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

Any thoughts on what can be done to allow these changes to synchronize?

Thanks!

Uninstall Drivesync

Hi.
I have problems with Drivesync and I would like to uninstall it to install it again. How can I do it?
Thanks.

Git clone not allowed

I had to setup my system new, installed git (Ruby was already installed) and did git clone [email protected]:MStadlmeier/drivesync.git. The result was:

The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.```

Strange errors in Ubuntu 20.04 LTS

Hi. First sry English isnt my native language.
I always use Your script in Ubuntu 18.04.4 and there it works with no problems.
I just fresh installed Ubuntu 20.04 and have little issue.

drivesync works ( syncing well ) but here always many errors:

ruby drivesync.rb /var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: _1' is reserved for numbered parameter; consider another name
/var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: _2' is reserved for numbered parameter; consider another name /var/lib/gems/2.7.0/gems/mime-types-3.1/lib/mime/types/logger.rb:28: warning: _3' is reserved for numbered parameter; consider another name
/var/lib/gems/2.7.0/gems/faraday-0.15.2/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use &block instead
/var/lib/gems/2.7.0/gems/faraday-0.15.2/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use &block instead
/var/lib/gems/2.7.0/gems/faraday-0.15.2/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use &block instead
/var/lib/gems/2.7.0/gems/faraday-0.15.2/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use &block instead
/var/lib/gems/2.7.0/gems/faraday-0.15.2/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use &block instead
/var/lib/gems/2.7.0/gems/multi_json-1.13.1/lib/multi_json/options_cache.rb:12: warning: Capturing the given block using Proc.new is deprecated; use &block instead
Local folder is 1 files behind and 0 files ahead of remote
Starting sync at 2020-04-27 18:01:48 +0200
Downloading file baza/Hasła.kdbx ...

Sync complete.
drivesync.rb:11: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open

Here linkt to pastebin
https://pastebin.com/gGijwruz

Cheers

Why are we deleting the local folder on doing a reset?

I accidentally did a reset thinking that all my configs would be reset only. Why does the default behavior delete local files? Why the destructive approach here? (I was lucky that I did not have a lot of important stuff but this is so problematic for most I would assume)!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.