Find files in google colab

Viewed 843

The following snippet in my google colab:

import sys
import os

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

path = '/content/gdrive/MyDrive/MBA/MBA_USP/03_Modulo_Solucoes/16_Metologia_Pesquisa_Projeto_Conclusao/TCC'
fnames = os.listdir(path)

prints my files and directories:

['TCC', 'degree_dist.eps', 'mind_dataset']

Now I'd like to search for files starting from the above path, like so:

if os.path.exists('mind_dataset/file.csv'):
    try:
        # do something

But this is not finding file.csv, which is there. How do I append or join paths to my present path in colab, in order to find any file?

0 Answers
Related