This project allows you to duplicate a complete folder structure from a Google Drive folder (shared or not) to your own Drive.
- Recursive Copy: Copies all files and subfolders.
- Time Limit Management: Handles the 6-minute execution time limit of Google Apps Script. If the copy isn't finished, you can resume it, and it will pick up exactly where it left off.
- Verification: Compares the file count between the source and destination to ensure integrity.
- Google Sheets Interface: Easy control via a spreadsheet.
- Create a new Google Sheet.
- Go to Extensions > Apps Script.
- Delete existing code in
Code.gs. - Copy the content of the
src/Code.jsfile from this repository and paste it into the editor. - Save.
- Reload your Google Sheet. A "Drive Duplicator" menu will appear.
If you have Node.js installed:
- Install clasp:
npm install -g @google/clasp - Login:
clasp login - Create a sheet:
clasp create --type sheets --title "Drive Duplicator"(or clone an existing project). - Push the code:
clasp push
The script expects the following columns (order isn't strict, but headers help):
| Row 1 | A | B | C | D |
|---|---|---|---|---|
| Headers | Source Folder ID | Status | Destination URL | Verification |
- Source Folder ID: The ID of the folder you want to copy (the part at the end of the folder URL).
- Status: Leave empty initially. The script will update it to "Pending", "Processing", "Done", or "Error".
- Destination URL: Populated by the script.
- Verification: Populated by the verification tool.
- Fill in the Source Folder ID in column A.
- Go to the menu Drive Duplicator > Start Copy.
- If the script stops (time limit), the status will remain "Processing" (or indicate "Time Limit"). Simply click Start Copy again to resume.
- Once finished, the status will be "Done".
- To verify, click Drive Duplicator > Verify Folder.