How To - gherynos/drivecopy GitHub Wiki

Command line options

Usage and command line options for Drive Copy:

usage: java -jar drivecopy.jar [OPTIONS] <MODE> [ENTRY]
Utility to download, replace and upload Google Drive binary files.

 -a,--archive                skip replace/download if local file and
                             remote entry MD5 summaries are the same.
 -C,--configuration <path>   where path is the path of the configuration
                             file. The default value is
                             'drivecopy.properties' in the same directory.
 -d,--directory <path>       where path is the local directory to
                             upload/download/replace (it will be archived
                             into a single remote file).
 -D,--delete                 delete local file/directory after remote
                             entry uploaded/replaced.
 -f,--file <path>            where path is the file to
                             upload/download/replace.
 -F,--force                  forces the creation of the remote entry when
                             replace is selected and the entry doesn't
                             exist.
 -l,--level <num>            where num is the compression level from 0 to
                             9. Used when uploading/replacing directories.
                             The default value is 0.
 -L,--log <file>             where file is the log file to write
 -m,--mimetype <type>        where type is the MIME type string to set for
                             the remote entry. The default values are
                             'application/octet-stream' for files and
                             'application/zip' for compressed directories.
 -s,--skiprevision           do not create a new revision when replacing
                             remote entry.
 -t,--tree                   create remote folders tree if one or more
                             remote folders are not found.
 -T,--terse                  set terse output.
 -v,--verbose                set verbose output.

MODE can be download/replace/upload.
ENTRY is the path of the entry in Google Drive (i.e. "Test Folder/Another
Folder/file.txt"); if not set, the name of the local file/directory will
be used.

Examples

Download a file

$ java -jar drivecopy -f <local_file> download <drive_entry>

This command downloads the content of the entry <drive_entry> and stores it into the file <local_file>.

Upload a file

$ java -jar drivecopy -f <local_file> upload <drive_entry>

This command uploads the content of the file <local_file> to the entry <drive_entry>.

Replace a file

$ java -jar drivecopy -f <local_file> replace <drive_entry>

This command replaces the entry <drive_entry> with the content of the file <local_file>, creating a new revision.

Backup a directory

$ java -jar drivecopy -d <local_directory> -l 9 upload <drive_entry>

This command creates a ZIP file with a compression level 9 containing all the files inside the directory <local_directory> and stores its content into the entry <drive_entry>.

Restore a directory

$ java -jar drivecopy -d <local_directory> download <drive_entry>

This command downloads the ZIP file contained into the entry <drive_entry> and extracts its content in the current folder.

⚠️ **GitHub.com Fallback** ⚠️