How to delete a locally uploaded file on google colab?

Abhiram Satputé picture Abhiram Satputé · Sep 10, 2018 · Viewed 40k times · Source

I'm trying to delete a file that I uploaded on Google colab using the following code:

from google.colab import files
uploaded = files.upload()

How to delete the file now? e.g If the file's name is 'sample.jpg' .

Answer

sarannns picture sarannns · Sep 24, 2018

Answer from @Korakot works for a single file and in case, to delete entire folder or subfolders or files

use

!rm -rf <folder_name>