0

I have accidentally trashed a lot of files, there are about 700 of them. I want to restore them. Drive doesn't provide a restore all option on the browser. So I thought of using Python on the Google Colaboratory to move the files out of Trash. But I am not able to find the 'Trash' directory.

# Mount the drive
from google.colab import drive
drive.mount('/content/drive')


import os
trash_dir = os.path.join('/content/drive/', 'Trash')
trashed_files = os.listdir(trash_dir)
## Then some code using os.rename to move the files to a new location.

But I get the following error.

FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/Trash'

How can I restore all the files from Trash using python on Google Colaboratory?

P.S: I am open to other methods, not involving colaboratory, to quickly rescue all my files.

Sashi
  • 79
  • 11

0 Answers0