Bash commands in the base directory removing all images

bash commands in the base directory removing all images.
while running the google colab notebook “C1W2_Ungraded_Lab_Birds_Cats_Dogs.ipynb”
The below commands remove all images:
!find /tmp/data/ -size 0 -exec rm {} +

!find /tmp/data/ -type f ! -name “*.jpg” -exec rm {} +

Do let me know what is the issue

Hello @Ravi_Soni,

Which course is this notebook belong to? I don’t recall this lab file’s name in the machine learning specialization. Btw, what do you mean by the issue? What is the expected behavior and what is the actual behavior?


Hi Raymond,
Here is the link for the ugraded lab uder week 2 section.

And this is the part ubder the notebook.

Hello @Ravi_Soni,

Thanks. Based on the titles provided in your last reply, I moved this thread to the Machine Learning Engineering for Production Category (MLEP) Course 1. I will let their mentors with more experience on the lab to take over from here.


1 Like

Hi @Ravi_Soni ,

Those two commands removed only the corrupted images in the dataset.
The first command filtered and removed any file that is 0 byte, while the second one removed any file that’s not a valid image file (such as .db).

If you run the next cells, you should the remaining images in the output:

There are 8750 images of cats for training
There are 8749 images of dogs for training
There are 8251 images of birds for training

There are 3749 images of cats for evaluation
There are 3750 images of dogs for evaluation
There are 3537 images of birds for evaluation

If the output don’t match, please send me the notebook and we can check what’s wrong.

Best regards,

1 Like

Thanks, i will revert back today after verifying that.
I am doing same but its emptying the folder anyway.

Hi @Ravi_Soni,

You can try refresh your workspace. If the error is still there, please send me your notebook so I can check the issue.