prasmussen / gdrive

Google Drive CLI Client
MIT License
8.99k stars 1.18k forks source link

How to manage shared drive? #637

Open mark888bs opened 2 years ago

mark888bs commented 2 years ago

i have another account share drive how to copy file in that folder?

thank you

jordanwmckee commented 2 years ago

Same here

Russtopia commented 2 years ago

@mark888bs @jordanwmckee I ran into this as well -- our work wants to put artifacts in an external shared Gdrive -- appears there is a separate set of APIs for specifying and accessing external drive filesystems. It would be really nice if there were a way to access those.

For now, a workaround: after pushing files/folders to your "My Drive", install a Google App Script to watch for new content and move it to the desired external drive:

# Install the following Google App Script under the same
# credentials you're using gdrive to push content; have it trigger
# on a timer to move new files to the ultimate intended dest
# folder. REMEMBER to update the Folder IDs below
# (NNNNNNNNNNNN and MMMMMMMMMMMM) to match
# your 'staging' and 'final' folder IDs.
########
#// Shamelessly stolen from https://stackoverflow.com/questions/40663814/move-files-automatically-from-one-folder-to-another-in-google-drive
#
#function copyFiles(source_folder, dest_folder) {
#
#  var source_folder = DriveApp.getFolderById('NNNNNNNNNNNNNNNNNNNNNNN'); 
#  var dest_folder = DriveApp.getFolderById('MMMMMMMMMMMMMMMMMM'); 
#  var files = source_folder.getFiles();
#
#  while (files.hasNext()) {
#
#    var file = files.next();
#    dest_folder.addFile(file);
#    source_folder.removeFile(file);
#
#  }
#}
########