I am trying to traverse my entire Google Drive, and place it all in a Pandas DF for later usage. I tried this quick code snippet, but it didn't work out as I hoped.
Printing out the total amount of data storage, I got about 3GB (~3000 MB), whereas according to Google Drive it holds about 17GB.
So either this code snippet isn't working properly, or there is some other kind of data that I do not reach here. For example, I know that "files shared with me" will not count into this. But I assume that I don't have 14GBs here
root_directory = '/content/drive/My Drive'
tot_size = 0
for (root, dirs, files) in os.walk(root_directory, topdown=True):
for filename in files:
fullpath = os.path.join(root, filename)
if not os.path.islink(fullpath):
tot_size += os.path.getsize(fullpath) / 1024 / 1024
print(f'total size is: {tot_size}')
So I have 2 questions:
- Is there something missing in the code?
- How do I reach the "files shared with me" using Google Colab.
Thanks!
I was expecting to get the entire 17GB that my drive holds, or at least most of it since there is a small chance that I am the owner of some of those files.
I made sure that I am successfully traversing through all my files