# How do i get to make colab read my images from my google drive?

I havee about 2000 images, I have uploaded them to my Google drive. How do I make colab see and read these images. All the images are in one folder.

There are some commands you must run, designed specifically for Colab:

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


With this, an authentication page will open. They want you to explicitly allow an access to your Drive. Click on the link and get a key code, that you can insert into an input line. At that point, you Colab Notebook is ready to access the data within you Drive account.

Each file path commonly starts with:

"/content/drive/My Drive/ ... your folders.../"


Within Colab Notebook, linux shell commands are also working, and can be accessd by putting ! before them (as in Jupyter).

NB: google.colab commands do not work outside Google Colab Notebooks, therefore, if you download your .ipybn file, remember to change those line or it'll throw error.

• I did this and assigned a variable to all content in the folder and tried to split the folder's content into training and testing, but it kept bring error. Can you direct me on how to get to splitting the data? – na2016 Jan 17 '20 at 9:00
• It's hard for me without knowing your code and your folder structure. Can you update your information? Please also consider creating a new question about it (since it's not exactly the same topic above) – Leevo Jan 17 '20 at 9:24
• Thank you. I have just created another question. I hope to get an answer there. – na2016 Jan 17 '20 at 9:30
• I joined this community to upvote your answer. /content/drive/My Drive/ this took me more than an hour to search for. Other permutations and combinations to get the folder path might not work. – Prasad Raghavendra Feb 27 '20 at 4:32