How to Copy an Entire Folder to Another Folder in Google Drive
Google Drive, launched almost 4 years ago, is an online vault where you can store all your files and documents. It offers nearly all the functionality that you would expect in a file manager app making it easier for you to manage files from within the browser. You can move files between folders, rename files, differentiate them with colors, add text notes for easier lookup and more.
However the one piece that is still missing in Google Drive is the ability to copy folders. You can duplicate any file in Google Drive by right-clicking the file and selecting “Make a Copy” but this option is not available for folders. A Google Script exists to copy folders in Google Drive but it is complicated.
Wouldn’t it be nice if there were an xcopy (Windows) or rsync (Mac, Unix) like command for Google Drive that would recursively copy everything inside a folder, easily It should not only copy all the files and subdirectories but also retain the directory tree structure and maintain the shared file permissions.
Well, we are not sure if Google will ever provide an option to duplicate folders in Google Drive but there’s an open source web app by Eric YD that does exactly what you are looking for. Here’s how to get started:
- Go to labnol.org/xcopy and click the Authorize button.
- Allow the app to access your Google Drive files. The app would perform the copy operation directly inside your Google account without involving a third-party server.
- Once authorized, select the source folder using the Google File picker and specify the destination folder name.
- Click the Copy Folder button to begin the cloning process.
That’s it. The script will run in the background and copy files, one-by-one, into the target folder. It will log everything in a Google Spreadsheet so you know what’s happening behind the scene.
While optional, the app can also retain permissions and in the case the copied files will be editable/viewable by the same people as the original files. The copying process would however take longer if you choose to copy the sharing permissions.
Say you have a folder in one Google account (A) that you would like to copy to another Google account (B). While the app doesn’t support copying across accounts, there’s a simple workaround:
- Use labnol.org/xcopy to copy the folder in its original account (A).
- Log into account B, create a blank folder and share it with account A.
- Log into account A and move the copied folder into the shared folder.
- Go back to account B and remove the sharing permissions for the folder.
The Alternative - If you are not comfortable giving access to your Google Drive to another app, you can manually copy folders using the Google Drive desktop client for Windows and Mac. Go to Windows Explorer (or Finder), select the source folder and press Ctrl+C followed by Ctrl+V to duplicate the folder.
This would however not retain the original file permissions. The other downside is that Google Drive will have to reupload all the copied files whereas in the previous case, the copying happened on Google servers directly.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.