---
title: "Copy folders from one gdrive to another "
slug: copy-folders-from-one-gdrive-to-another
canonical_url: https://mimansajaiswal.github.io/posts/copy-folders-from-one-gdrive-to-another/
collection: Blurbs
published_at: 2024-01-05T00:00:00.000Z
updated_at: 2024-01-05T00:00:00.000Z
tags: 
  - Software
  - Code
author: "Mimansa Jaiswal"
---

## Navigation Context

- Canonical URL: https://mimansajaiswal.github.io/posts/copy-folders-from-one-gdrive-to-another/
- You are here: Home > Posts > Blurbs > Copy folders from one gdrive to another 

### Useful Next Links
- [Home](https://mimansajaiswal.github.io/)
- [Publications](https://mimansajaiswal.github.io/papers/)
- [Blurbs](https://mimansajaiswal.github.io/collections/blurbs/)
- [Fieldnotes](https://mimansajaiswal.github.io/collections/fieldnotes/)
- [Personal](https://mimansajaiswal.github.io/collections/personal/)
- [Research](https://mimansajaiswal.github.io/collections/research/)

You just graduated and your university is downgrading you to the 15GB plan on google drive?

And you have 200GB on there?

And you do not want to download all of it using google takeout?

You can use this method.

1.  Share the folder to your personal account
2.  Wait at least 2 days for permissions to propogate
3.  Add shared folder as shortcut in _My Drive_
4.  Open colab, paste the following code, modify the folder names and run
5.  Give permissions to access drive
6.  **Make sure you note down which files are not copied — because google suite specific files are not (slides, sheets, docs etc) — but they are usually tiny anyway.**

```
from google.colab import drive
import os

print('Mounting Google Drive...')
drive.mount('/gdrive')

src_path = '/gdrive/MyDrive/UMich' #@param {type: 'string'}
assert os.path.exists(src_path), f"Source '{src_path}' doesn't exist!"

target_path = '/gdrive/MyDrive/Copied From UMich' #@param {type: 'string'}
os.makedirs(target_path, exist_ok=True)
assert os.path.exists(target_path), f"Target '{target_path}' doesn't exist!"

target_path = os.path.join(target_path, os.path.basename(src_path))
print(f'Copying from "{src_path}" to "{target_path}"...')
os.makedirs(target_path, exist_ok=True)
!cp -rn "$src_path"/* "$target_path"  # also work when source is a shortcut
```

Code to copy from a shared folder to personal drive using Google colab

* * *

## Cite This Page

```
@article{jaiswal2024copyfoldersfrom,
  title   = {Copy folders from one gdrive to another },
  author  = {Jaiswal, Mimansa},
  journal = {mimansajaiswal.github.io},
  year    = {2024},
  month   = {Jan},
  url     = {https://mimansajaiswal.github.io/posts/copy-folders-from-one-gdrive-to-another/}
}
```