Add Files/Folders to Multiple Drive Folders on Mobile

13.6 min read|Last Updated: August 17th, 2024|Categories: GSuite|

Google Drive has a feature for adding multiple files or folders to different directories without having to copy them individually. If you edit a file in a folder, all the instances of the file are updated automatically.

To do this, please follow these steps,

  1. Login to your Google drive in a browser,
  2. Select your intended file or folder,
  3. Press Shift+Z,
  4. Select your destination folder

However, this feature is not available on the Google Drive app for mobile devices because you can’t select a file or folder and simultaneously press Shift and Z buttons on your phone.

In this blog, we discuss a workaround for Shift+Z functionality for the Google Drive app on mobile devices such as Android phones or iPhones.

// This function add a file or folder to another folder. function ShiftZ() {

// Original File or Folder

// If you want to add a file to a folder, enter the file ID inside the quotations below. // If you're not adding any file, leave inside the quotation blank var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// If you want to add a folder to a folder, enter the folder ID inside the quotations below. // If you're not adding any folder, leave inside the quotation blank var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// Destination Folder

// Enter the ID of the destination folder var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function

if (orgFileID.length > 0 ) { var orgFile = DriveApp.getFileById(orgFileID); DriveApp.getFolderById(desFolderID).addFile(orgFile); // Add the report folder to Ahmad's Dabiri Folder }

if (orgFolderID.length > 0 ) { var orgFolder = DriveApp.getFolderById(orgFolderID); DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder } }

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

px” aria-hidden=”true” class=”wp-block-spacer”>

Google App Script Solution Instead of Shift+Z

To perform Shift+Z on Google Drive Mobile App, please run the app script explained in this blog.

Find the ID of Google Drive File

First, find the ID of the source file or folder. The URL of the file and folder contains their unique ID. To determine a file ID, by right-clicking the slight file, select SHARE, and click ADVANCED, everything after https://drive.google.com/drive/folders/ is your file ID.

<!– wp:embed {“url”:”https://youtu.be/tU

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

lQqfbJ-M”,”type”:”video”,”providerNameSlug”:”youtube”,”responsive”:true,”align”:”center”,”className”:”caption-align-center wp-embed-aspect-16-9 wp-has-aspect-ratio”} –>

https://youtu.be/tU

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

lQqfbJ-M

Determination of file ID on Google Drive

Determination of file ID on Google Drive

 

Determination of file ID on Google Drive

Find the ID of Google Drive Folder

To achieve the folder ID, open it and use the URL in the address field of the browser, as shown in the image.

Google Drive Folder ID

 

Determination of folder ID in Google Drive

Also, to have the file/folder ID on the mobile device, select the vertical ellipsis beside the file/folder and choose Copy Link, like the image below, and extract the ID.

<!– wp:image {“align”:”center”,”id”:867,”width”:512,”height”:47

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

,”sizeSlug”:”large”,”className”:”caption-align-center”,”captionAlignment”:”center”} –>

// This function add a file or folder to another folder. function ShiftZ() {

// Original File or Folder

// If you want to add a file to a folder, enter the file ID inside the quotations below. // If you're not adding any file, leave inside the quotation blank var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// If you want to add a folder to a folder, enter the folder ID inside the quotations below. // If you're not adding any folder, leave inside the quotation blank var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// Destination Folder

// Enter the ID of the destination folder var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function

if (orgFileID.length > 0 ) { var orgFile = DriveApp.getFileById(orgFileID); DriveApp.getFolderById(desFolderID).addFile(orgFile); // Add the report folder to Ahmad's Dabiri Folder }

if (orgFolderID.length > 0 ) { var orgFolder = DriveApp.getFolderById(orgFolderID); DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder } }24×939.png” alt=”Google drive Folder – Copy Link” class=”wp-image-867″ width=”512″ height=”47

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

“/>

 

Determination of folder ID in Google Drive

Copy Code to Google App Script

Next, create a new project in https://script.google.com/. And copy-paste the following code in your new project file, and save it.

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

>

Next, set the variables as follows:

  • If you want to add a file to multiple folders, set the orgFileID variable equal to the file ID.
  • If you want to add a folder to another folder, set orgFolderID variable equal to the original folder ID.
  • And set the desFolderID variable equal to the ID of the destination folder.

Run ShiftZ Function

To execute the ShiftZ function, select the function from the dropdown and click the Start icon, as shown in the image below.

Run ShiftZ Function on Google Drive Script

 

Run ShiftZ function on Google Drive Script.

Google Drive might ask you for permission to execute the app script when you run the script for the first time. After the execution, check the destination folder to verify if your file/folder is added.

// This function add a file or folder to another folder. function ShiftZ() {

// Original File or Folder

// If you want to add a file to a folder, enter the file ID inside the quotations below. // If you're not adding any file, leave inside the quotation blank var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// If you want to add a folder to a folder, enter the folder ID inside the quotations below. // If you're not adding any folder, leave inside the quotation blank var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// Destination Folder

// Enter the ID of the destination folder var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function

if (orgFileID.length > 0 ) { var orgFile = DriveApp.getFileById(orgFileID); DriveApp.getFolderById(desFolderID).addFile(orgFile); // Add the report folder to Ahmad's Dabiri Folder }

if (orgFolderID.length > 0 ) { var orgFolder = DriveApp.getFolderById(orgFolderID); DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder } }

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

px” aria-hidden=”true” class=”wp-block-spacer”>

Starred Projects

You can add a star to this project file to list it in your Starred Projects for quick access for later uses. In your G Suites Developers Hub, select your project, click the vertical three dots in front of it, and select “Add star”, as explained in the image below.

Starred projects for quick access - Google Drive

 

Starred projects for quick access – Google Drive

The project is then added to your Starred Projects.

<!– wp:image {“align”:”center”,”id”:87

 

,

// This function add a file or folder to another folder.
function ShiftZ() {
                                                                                                 
  // Original File or Folder
  
  // If you want to add a file to a folder, enter the file ID inside the quotations below.
  // If you're not adding any file, leave inside the quotation blank
  var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // If you want to add a folder to a folder, enter the folder ID inside the quotations below.
  // If you're not adding any folder, leave inside the quotation blank
  var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function
  
  // Destination Folder
  
  // Enter the ID of the destination folder
  var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function
 
  if (orgFileID.length > 0 ) {
      var orgFile = DriveApp.getFileById(orgFileID);
      DriveApp.getFolderById(desFolderID).addFile(orgFile);  // Add the report folder to Ahmad's Dabiri Folder
  }
  
  if (orgFolderID.length > 0 ) {
      var orgFolder = DriveApp.getFolderById(orgFolderID);
      DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder
  }
}

,”sizeSlug”:”large”,”className”:”caption-align-center”,”captionAlignment”:”center”} –>

Starred projects for quick access - Google Drive// This function add a file or folder to another folder. function ShiftZ() {

// Original File or Folder

// If you want to add a file to a folder, enter the file ID inside the quotations below. // If you're not adding any file, leave inside the quotation blank var orgFileID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// If you want to add a folder to a folder, enter the folder ID inside the quotations below. // If you're not adding any folder, leave inside the quotation blank var orgFolderID = ""; // <<-- **Attention!** Insert the ID, if any, before running the function

// Destination Folder

// Enter the ID of the destination folder var desFolderID = ""; // <<-- **Attention!** Insert the ID, before running the function

if (orgFileID.length > 0 ) { var orgFile = DriveApp.getFileById(orgFileID); DriveApp.getFolderById(desFolderID).addFile(orgFile); // Add the report folder to Ahmad's Dabiri Folder }

if (orgFolderID.length > 0 ) { var orgFolder = DriveApp.getFolderById(orgFolderID); DriveApp.getFolderById(desFolderID).addFolder(orgFolder); // Add the account folder to admin folder } }“/>

 

Starred projects for quick access – Google Drive

Boost your productivity by getting a free consultation from Excel experts, and discover tailored solutions to optimize your data management and analysis.

Our experts will be glad to help you, If this article didn't answer your questions.

Share now:

About the Author: Hajir Hoseini

One Comment

  1. Stephen May 11, 2022 at 3:07 am - Reply

    Thank you so much for this script. Is there a way to use a list of file IDs to make a copy of the file?

Leave A Comment

contact us

Contact us today at and speak with our specialist.