Skip to content
Advertisement

Linux command How to delete all with .html extension

i am using putty, want to delete all files which having .html extension

I am trying the below ways

1st get the file by using find command

find . -name "*.html" -type f

Listing all files having .html extension

now i am going to delete those files

find . -name "*.html" -type f -delete

OR

find . -name "*.html" -type f -exec rm {} +

both are not working for me, anybody know solution

Thanks

Advertisement

Answer

make sure you’re deleting the right files first!

 find . -name "*.html" -type f

To delete regardless of permissions…

sudo find . -name "*.html" -type f -delete
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement