skip to Main Content
Welcome to Gimasys!
Hotline: +84 974 417 099 (HCM) | +84 987 682 505 (HN) gcp@gimasys.com

How to copy Google Drive folder

Google Drive is a popular file storage and sharing tool, but many people still have difficulty copying folders, especially when they want to copy folders from someone else's Drive to their own Drive. This article will guide you how to copy a Google Drive folder through basic steps and using scripts.

Copy Someone Else's Drive Folder to Your Google Drive

Step 1: Get Access

To copy a folder from someone else's Google Drive, you first need access permission. The folder owner needs to share it with you with "Viewer" or "Editor" rights.

Step 2: Use the “Make a Copy” Function

Open Folder: Log in to your Google Drive, open the shared folder.

Select All Files: Click on each file in the folder and select “Make a copy” from the right-click menu.

Create New Folder: Create a new folder in your Drive and paste all the copies there.

Note: This method only works with a small number of files because you need to do it manually for each file.

Use Script To Copy Folder

When you have to copy a folder with many files, using a script will save much time. Here's how:

Step 1: Create Google Apps Script

Go to Google Drive: Sign in to your Google Drive.

Create New Google Apps Script: Select “New” > “More” > “Google Apps Script”.

Name the Script: Name your script project.

Step 2: Write Copy Script

Below is an example of a possible script:

javascript

Copy the code

function copyFolder(sourceFolderId, targetFolderId) {

  var sourceFolder = DriveApp.getFolderById(sourceFolderId);

  var targetFolder = DriveApp.getFolderById(targetFolderId);

  var files = sourceFolder.getFiles();

  while (files.hasNext()) {

    var file = files.next();

    file.makeCopy(file.getName(), targetFolder);

  }

  var subFolders = sourceFolder.getFolders();

  while (subFolders.hasNext()) {

    var subFolder = subFolders.next();

    var newTargetSubFolder = targetFolder.createFolder(subFolder.getName());

    copyFolder(subFolder.getId(), newTargetSubFolder.getId());

  }

}

Step 3: Run the Script

Enter Source and Destination Folder IDs: Replace sourceFolderId and targetFolderId with the IDs of the source and destination folders in your Drive.

Run Script: Click the “Run” button to run the script.

Note: You need to grant access to the script so it can operate on your Drive.

Register to Use Other People's Scripts

If you don't want to create scripts yourself, you can find scripts available on the Internet or from others. Just make sure that the script comes from a trusted source and won't harm your data.

Conclude

How to copy a Google Drive folder can be simple or complicated depending on the number of files and folders that need to be copied. Using scripts can be worthwhile in complex cases, but always be careful when using scripts from unknown sources.

As a senior partner of Google in Vietnam, Gimasys has more than 10+ years of experience, consulting on implementing digital transformation for 2000+ domestic corporations. Some typical customers Jetstar, Dien Quan Media, Heineken, Jollibee, Vietnam Airline, HSC, SSI...

Gimasys is currently a strategic partner of many major technology companies in the world such as Salesforce, Oracle Netsuite, Tableau, Mulesoft.

Contact Gimasys - Google Cloud Premier Partner for advice on strategic solutions suitable to the specific needs of your business:

  • Email: gcp@gimasys.com
  • Hotline: 0974 417 099
Back To Top
0974 417 099