This is a command line tool of Google drive's services written in Java, which can be used as building blocks in some batch processing pipelines.
- Java 8 or later
- Maven 3.6.0 or later
- Internet connection (to download dependencies)
Modify the configurations in config.properties
file.
Run mvn clean package
under the project directory.
Run mvn install
.
First create your personal credentials.json
at here.
Put this file under the same dir as .jar
file generated by mvn
.
If it is the first time you run this program, the login window will pop up automatically and guid you complete the authentication process. After that, your token will be stored on your local machine to avoid later login.
usage: java -jar drive_service-1.0-jar-with-dependencies.jar
-create_folder create a folder in Google drive
-help print help message
-i <arg> path to the upload file
-list <arg> list files in this folder
-name <arg> name in Google drive
-parent <arg> parent folder id
-type <arg> type of the upload file
-upload upload a file to given folder
-upload_data upload a data file to the default folder
- List files:
java -jar drive_service-1.0-jar-with-dependencies.jar -list folder_id
- Upload an image:
java -jar drive_service-1.0-jar-with-dependencies.jar -upload -i path_to_image/mypic.png -name mypic -parent parent_folder_id -type image/png
- Upload data file to default folder:
java -jar drive_service-1.0-jar-with-dependencies.jar -upload_data -i path_to_data/my_data.csv