Coder Social home page Coder Social logo

siom79 / jdrivesync Goto Github PK

View Code? Open in Web Editor NEW
44.0 12.0 14.0 234 KB

jdrivesync is a simple command line tool that synchronizes a local file system structure to your Google Drive (and back)

Home Page: https://siom79.github.io/jdrivesync/

License: Apache License 2.0

Java 98.70% Smarty 1.04% Shell 0.26%

jdrivesync's Introduction

jdrivesync

jdrivesync is a simple command line tool that synchronizes a local file system structure to your Google Drive (and back):

java -jar jdrivesync-0.4.2-jar-with-dependencies.jar -l "/home/siom79"

The website is located at http://siom79.github.io/jdrivesync/.

Development

If you want to contribute, you can fork the project into your github account, create a feature branch and later submit your changes in form of a pull request.

Coding styles

Please format your code according to the Java Conventions as they are provided by your IDE (IntelliJ, Eclipse) with the following changes:

  • Line length: 180
  • Newline: LF

Build

The sources are build using the JDK (>= 11) and maven (>= 3.9). To build jdrivesync from scratch execute these commands:

git clone https://github.com/siom79/jdrivesync.git
cd jdrivesync
mvn install

After successful compilation you can execute jdrivesync with this command:

java -jar target/jdrivesync-0.4.3-jar-with-dependencies.jar

The deb package is created with the maven plugin jdeb during the build and is located in the target directory.

Version control

Version control follows the guidelines known as gitflow. This means basically that the master branch is always in a releasable state and that all work is done on feature branches that are later on merged to the develop branch.

Integration tests

Integration tests are written with JUnit and reside under src/test/java. The class names have to start with IT in order to distinguish them from normal unit tests. To run the integration tests place a valid authentication file under src/test/resources/.jdrivesync and execute them with (as they are not executed during a normal build):

mvn test -Pintegration-test

Please use a separate Google account for these integration tests as they are written to delete and to list all files of the account.

Continous Integration

Github Actions

Release

  • Set the release version:
     mvn versions:set -DnewVersion=<version>
     mvn versions:commit
     git add .
     git commit -m "Version set <version>"
    
  • Create a git tag:
     git tag v<version>
     git push origin --tags
    
  • The release is automatically created by a Github Action
  • Set the next SNAPSHOT version:
     mvn versions:set -DnewVersion=<version>-SNAPSHOT
     mvn versions:commit
     git add .
     git commit -m "Version set <version>-SNAPSHOT"
    

Website

  • Checkout tag and run site plugin:
cd /tmp
git clone --branch v<verion> https://github.com/siom79/jdrivesync.git
cd jdrivesync
mvn site:site
mvn site:stage
cp -r target/staging $SIOM79_GITHUB_IO_REPO

jdrivesync's People

Contributors

brettbatie avatar siom79 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

Watchers

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

jdrivesync's Issues

Ignore folder

Hi,

There should be an option to ignore directory, seems like -i is not helping with regular expression.

As example:
sudo java -jar jdrivesync.jar --dry-run -l "/home/yasir/Google" -i /home/yasir/Google/Documents/**
Could not read file '/home/yasir/Google/Documents/Budget':Is a directory

udo java -jar jdrivesync.jar --dry-run -l "/home/yasir/Google" -i "/home/yasir/Google/Documents/Budget/"
'/home/yasir/Google/Documents/Budget/
' does not exist.

Default authentication file is misplaced

The authentication file should not just be written to the current directory by default. The old UNIX way would be to put that file to the home directory. The XDG way would be to put it to ~/.local/share/jrivesync. If cross-platform compatibility is desired, there are some ways to find the home directory in a portable way, see e.g. http://gamedev.stackexchange.com/questions/23040/is-there-a-cross-platform-special-directory-i-can-use-for-game-save-files

The problems with using the current directory are:

  • It may be read-only.
  • It may be exposed to other users.
  • Users may not remember where the program was run the first time.

Trailing space crash on Windows

Hello,

This bug only seems to affect Windows machines, and does not seem to affect Unix machines.

Files with a trailing space character crash the program on Windows:

2015-11-12 14:06:09 SEVERE jdrivesync.App main(): The following error occurred: Trailing char < > at index 18: c:\sync\38889-PT
java.nio.file.InvalidPathException: Trailing char < > at index 18: c:\sync\38889-PT
        at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
        at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at sun.nio.fs.WindowsPath.parse(Unknown Source)
        at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
        at java.io.File.toPath(Unknown Source)
        at jdrivesync.fs.FileSystemAdapter.createDirectory(FileSystemAdapter.java:134)
        at jdrivesync.sync.Synchronization$2.createLocalDir(Synchronization.java:478)
        at jdrivesync.sync.Synchronization$2.processRemoteFilesWithoutLocalFile(Synchronization.java:359)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:340)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:87)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:34)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:315)
        at jdrivesync.App.sync(App.java:95)
        at jdrivesync.App.run(App.java:53)
        at jdrivesync.App.main(App.java:26)

jdrivesync should have a '--no-delete' option that prevents the deletion of files from the target

"jdrivesync handles synchronization very well. But, for some applications, a simple copy or move operation is what is required.

For example, my application is a Raspberry Pi based wildlife camera. The camera writes jpeg and mp4 files onto its SD card, and a cron job periodically uploads these files to Google Drive using jdrivesync. I would like to be able to delete the files from the SD card once they have been uploaded, to free up space on the SD card. However, if I do this, the next synchronization deletes the files from Google Drive.

I would like to suggest a "--no-delete" option, that would prevent jdrivesync from deleting files from the target that have been removed from the source. I believe this would be easy to implement, and would make jdrivesync a much more flexible tool."

M. Fisher via email

Report not clear when using --no-delete

Using the command
/opt/jdrivesync/jdrivesync.sh --down --no-delete -l "/home/mrfoobar/cloud/test" -r Publicaties/Inboxdocument
works as desired, but this testcase generated report below. Why are the files reported as deleted, when nothing actually is deleted? In this testcase it's about 10 files I move around. In a live-situation it has to work with more files.

2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/document 2017 - 14.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/document 2017 - 21.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/document 2017 - 28.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/document 2017 - 7.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/architecture-2083687_1280.jpg
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/archway-700875_640.jpg
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/cp-kn_pdf_2017_no._14.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/lvdk2013-745.pdf
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/red.txt
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /home/mrfoobar/cloud/test/reed-546250_640.jpg
2017-07-19 15:28:41 INFO jdrivesync.report.NoopReport log(): Synchronized Created /e.l._213.pdf
2017-07-19 15:28:42 INFO jdrivesync.App printStatistics(): Statistics:
2017-07-19 15:28:42 INFO jdrivesync.App printStatistics(): NEW: 1 file
2017-07-19 15:28:42 INFO jdrivesync.App printStatistics(): DELETED: 10 files
2017-07-19 15:28:42 INFO jdrivesync.App printStatistics(): UPDATED: 0 files
2017-07-19 15:28:42 INFO jdrivesync.App printStatistics(): UNCHANGED: 0 files

Cannot download Google app document

When I ran the program, it ignores all the Google app documents and not download them to local folder. Is this part of the design decision? I suppose that the app is using Google Drive v2, which seems to not have the export function like v3 to download Google App documents. Is the developer team intending to add this function in the future?

How to empty a cloud folder properly

Working on a script in a case where multiple users upload files to an inbox-folder on Google Drive. Script is downloading, doing some stuff, moving & renaming according some scripting and uploading renamed files to different folders. Just working fine ;-)

At some point, i want to clear the inbox. However, in the meantime the script is running, user x can have added a new file to the inbox.

How can i prevent that new files will be removed? Or did i miss an argument?

Now i've (inbox is cloud-folder, down is local folder):

## download to local folder
/opt/jdrivesync/jdrivesync.sh --down -r "$inbox" -l "$down" 

{do stuff}

## empty local folder
rm -rf "$down"/*
rm -rf "$down"/.[a-z]*
## upload empty folder = empty cloud folder
/opt/jdrivesync/jdrivesync.sh --up -r "$inbox" -l "$down" 

Large cpu consumption

Hi Martin,

jdrivesync does the job well, but it is quite slow.
I just used jdrivesync to synchronise a 22MB file to my Google drive, but it takes ages to upload:
It took 2082690 ms for 22566928 bytes: 10.59 KB/s with one core at 100% all the time. Is there a way to speed it up?

Problem with .trash being deleted and put into new .trash

Hello,

I'm having a problem where .trash gets deleted and put into a new .trash, while doing a download. This results in a folder structure like /test/.trash/.trash/.trash etc. (where "test" is my local folder) after several runs.
You can reproduce this by:

  1. In you local folder, create a file that doesn't exist on your Google Drive (touch test.txt).
  2. Run jdrivesync multiple times for download. This is my command:

/usr/local/bin/java -jar /usr/home/admin/jdrivesync-0.3.0-jar-with-dependencies.jar -a "/home/admin/.test-auth" -d -l "/test"

Every time it runs, the summary shows, "Synchronized Deleted /test/.trash". After a few runs, I'll have several copies of .trash inside of itself.

Here is my output after running the command a few times:

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 WARNING jdrivesync.fs.FileSystemAdapter delete(): Could not move file to .trash directory: /test/.trash/.trash/.trash
java.nio.file.FileAlreadyExistsException: /test/.trash/.trash/.trash
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:429)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at jdrivesync.fs.FileSystemAdapter.delete(FileSystemAdapter.java:112)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:79)
        at jdrivesync.fs.FileSystemAdapter$1.postVisitDirectory(FileSystemAdapter.java:68)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at jdrivesync.fs.FileSystemAdapter.deleteDirectorySubtree(FileSystemAdapter.java:68)
        at jdrivesync.sync.Synchronization$2.processRemoteChildNotFound(Synchronization.java:394)
        at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:342)
        at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:88)
        at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
        at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
        at jdrivesync.App.sync(App.java:89)
        at jdrivesync.App.run(App.java:54)
        at jdrivesync.App.main(App.java:27)

2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Deleted /test/.trash
2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Unchanged /kandace
2016-03-09 13:06:27 INFO jdrivesync.report.NoopReport log(): Synchronized Unchanged /mark
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): Statistics:
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): NEW:       0 files
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): DELETED:   1 file
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): UPDATED:   0 files
2016-03-09 13:06:28 INFO jdrivesync.App printStatistics(): UNCHANGED: 2 files
Finished uploads1 download

I've tried putting .trash and (star)(star)/.trash and (star)(star)/(star).trash into an ignore file and using -i, but no luck, that didn't help. (by star, I mean * , I think markdown is changing them)

Any ideas, or whether I'm doing something wrong?
Thanks!

Error if updating a remote file.

When jdrviesync has to update a local (newer and changed) file over a remote one, I get an exception.

My command:

java -jar jdrivesync-0.4.3-jar-with-dependencies.jar --log-file ~/.jdrivesync.log --checksum --local-dir "/data" --remote-dir "/" --ignore-file "/jdrivesync_ignore.txt" --up

Relevant logging output with traceback:

...
2018-03-28 18:44:13 INFORMATION jdrivesync.gdrive.GoogleDriveAdapter updateFile(): Updating file 1c7HV8BcRzwk6Zukq71epZ76Yb5ocM1DA (/data/subfolder/info.txt).
2018-03-28 18:44:24 WARNUNG jdrivesync.sync.Synchronization$1 visitDirectory(): Skipping file/directory '/data/subfolder' because an exception occurred: null
java.lang.IllegalArgumentException
	at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:111)
	at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:37)
	at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:331)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:427)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
	at jdrivesync.gdrive.GoogleDriveAdapter.lambda$updateFile$12(GoogleDriveAdapter.java:226)
	at jdrivesync.gdrive.RetryOperation.executeWithRetry(RetryOperation.java:28)
	at jdrivesync.gdrive.GoogleDriveAdapter.updateFile(GoogleDriveAdapter.java:226)
	at jdrivesync.sync.Synchronization$1.performChecksumCheck(Synchronization.java:264)
	at jdrivesync.sync.Synchronization$1.processRemoteChildFound(Synchronization.java:171)
	at jdrivesync.sync.Synchronization$1.visitDirectory(Synchronization.java:70)
	at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:58)
	at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:65)
	at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:65)
	at jdrivesync.fs.FileSystemWalker.walk(FileSystemWalker.java:34)
	at jdrivesync.sync.Synchronization.syncUp(Synchronization.java:52)
	at jdrivesync.App.sync(App.java:87)
	at jdrivesync.App.run(App.java:54)
	at jdrivesync.App.main(App.java:27)

2018-03-28 18:44:24 INFORMATION jdrivesync.report.NoopReport log(): Error(n.a.) Skipped /data/subfolder
...

The file "/data/subfolder/info.txt" exists locally and remotly but has updated locally.

When I remove the remote one, the file will be uploaded correctly.

My local folder "/data" lives on an encrypted "encfs" layer and I'm using ArchLinux with the following java version:

>>> java -version
openjdk version "1.8.0_162"
OpenJDK Runtime Environment (build 1.8.0_162-b12)
OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)

Thanks for help, time and providing this great Tool!

Great tool, here are some improvement ideas

Hey there, first of fall congrats to a tool that works perfectly fine!
There is still potential though to make it sweeter.

  • Delete file after sync - simple to implement

  • A "process daemon", so process stays alive - would make for a kick-ass synchronization tool because now you have to schedule the synchronizations manually, should be simple enough to implement too

  • Filter - filter the files to upload - could be based on type, e.g. .JPG only or .DOCX only

Please keep maintaining, for me this project is closing a functionality gap with the Drive sync' tools. In particular the option to choose where to upload everything to sounds trivial but no, does not work with the aforementioned tools. I was considering writing my own batch job before I tried your sync tool, and a good idea that was. Well done, to repeat myself!

Exception in thread "main" java.lang.OutOfMemoryError: Required array size too large

Hi

We are using this to sync a large amount of data (currently 131,899 Files, 16.9 TB). It seemed to work fine with the initial upload to google drive, but now it gets around 5.5TB through (mostly unchanged files) then crashes with the following:

Exception in thread "main" java.lang.OutOfMemoryError: Required array size too large
at java.nio.file.Files.readAllBytes(Unknown Source)
at jdrivesync.sync.Synchronization.computeMd5Checksum(Synchronization.java:284)
at jdrivesync.sync.Synchronization.access$300(Synchronization.java:35)
at jdrivesync.sync.Synchronization$1.performChecksumCheck(Synchronization.java:257)
at jdrivesync.sync.Synchronization$1.processRemoteChildFound(Synchronization.java:178)
at jdrivesync.sync.Synchronization$1.visitDirectory(Synchronization.java:68)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:57)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walkInternal(FileSystemWalker.java:64)
at jdrivesync.fs.FileSystemWalker.walk(FileSystemWalker.java:33)
at jdrivesync.sync.Synchronization.syncUp(Synchronization.java:50)
at jdrivesync.App.sync(App.java:93)
at jdrivesync.App.run(App.java:53)
at jdrivesync.App.main(App.java:26)

Windows Server 2012 R2, Java 8 Update 66 - x64

Build instructions are missing

There should be an instruction how to build jdrivesync from source. It may be obvious for Java developers, but not for every "grive refugee" who wants to try the latest code and possibly contribute a patch or two. Please specify what versions of maven are needed, how to run them to compile and install the program, how to make a Debian package. Let's start with something basic, and somebody would contribute instructions how to build an rpm or maybe compile the package natively.

Writing log to the current directory is very non-UNIXy

jdrivesync has no option to disable logging and it fails with a long stacktrace if run in a non-writable directory.

If jdrivesync is run by the user on the command line, it should log to the console only. If jdrivesync is run non-interactively, there should be a way to log its activity using syslog or a file specified on the command line. No respectable utility writes logs to the current directory by default. The directory may not be writable. The directory may be used for something else, and users don't expect logs to be written there. The log contents may be confidential and it could end up in a directory available to other users.

Getting MalformedURLException while downloading files to local directory

Hi,

I am stuck with a problem while synchronizing files, in particular, trying to download files from GDrive to local directory.
I run it with following parameters: jds -d -r / -l /media/shared/gdrive/ where jds is a shortcut for java -jar ....
After syncing some files I'm getting the following exception trace:

2015-05-14 00:22:55 FINE jdrivesync.sync.Synchronization$2 processRemoteFilesWithoutLocalFile(): Downloading file '/Recon 2011.docx'.
2015-05-14 00:22:55 SEVERE jdrivesync.App main(): The following error occurred: java.net.MalformedURLException
java.lang.IllegalArgumentException: java.net.MalformedURLException
    at com.google.api.client.http.GenericUrl.parseURL(GenericUrl.java:638)
    at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:114)
    at jdrivesync.gdrive.GoogleDriveAdapter.downloadFile(GoogleDriveAdapter.java:162)
    at jdrivesync.sync.Synchronization$2.processRemoteFilesWithoutLocalFile(Synchronization.java:367)
    at jdrivesync.sync.Synchronization$2.visitDirectory(Synchronization.java:340)
    at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:85)
    at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:34)
    at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:315)
    at jdrivesync.App.sync(App.java:87)
    at jdrivesync.App.run(App.java:52)
    at jdrivesync.App.main(App.java:26)
Caused by: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:620)
    at java.net.URL.<init>(URL.java:483)
    at java.net.URL.<init>(URL.java:432)
    at com.google.api.client.http.GenericUrl.parseURL(GenericUrl.java:636)
    ... 10 more
Caused by: java.lang.NullPointerException
    at java.net.URL.<init>(URL.java:525)
    ... 13 more

If I re-run the command - it crashes again with the same FINE log entry as before, meaning it always crashes on the same file(I guess).
I'm running it on Linux box with Oracle Java 1.8.0.45.
I would be glad to provide more info on your request.
Thanks!

Parameter max file size fails

[oriol@homer soft]$ java -Xmx8G -jar jdrivesync-0.4.1-jar-with-dependencies.jar -m -1000 -d -l /phi/users/oriol/gdrive_upf/ -r /
....
2017-11-28 12:33:04 GRAVE jdrivesync.App main(): The following error occurred: null
java.lang.NullPointerException
at java.lang.Long.compareTo(Long.java:1234)
at jdrivesync.gdrive.GoogleDriveWalker.fileShouldBeIgnored(GoogleDriveWalker.java:123)
at jdrivesync.gdrive.GoogleDriveWalker.walkInternal(GoogleDriveWalker.java:81)
at jdrivesync.gdrive.GoogleDriveWalker.walk(GoogleDriveWalker.java:35)
at jdrivesync.sync.Synchronization.syncDown(Synchronization.java:321)
at jdrivesync.App.sync(App.java:89)
at jdrivesync.App.run(App.java:54)
at jdrivesync.App.main(App.java:27)

2-ways sync

It will be nice to have 2-ways sync. In my case, I will operate my photos in my ubuntu computer, and do not know when will my mobile sync any new photos to google drive. I am afraid a 1-way sync(upload of new content from my ubuntu to google drive) will erase my random upload photos from my mobiles.

Special Characters

Hi

I need to exclude Office Temp Files from sync and files starting with ~$ still created until the rule is present in the .jdrivesyncignore file

Can you let me know

Thanks and regards

Statistics is not specific enough without the direction

"UPDATED: 1" could mean that all is good or that a major disaster has occurred and the data has been lost. It all depends on the direction. I believe the direction should be indicated for every file operation that is logged.

Also, the statistics should be split by direction for UPDATED, NEW and DELETED. For example, "UPDATED (up)" and "UPDATED (down)". An additional CONFLICT field should be added for the files that have been changed on both sides and jdrivesync has not been given the explicit direction. Empty stats could be skipped.

jdrivesync ignores -r option and filename

I have a local directory "Foxcam_Images" containing a single file: testfile
I have a Drive folder also called "Foxcam_Images"

The following command should upload the file to the remote folder. It does upload the file, but it is uploaded as a file called "Untitled" in my Drive's root directory.

java -jar jdrivesync-0.4.0-jar-with-dependencies.jar -u --no-delete -l Foxcam_Images -r Foxcam_Images

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.