Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove file from folder and subfolder single command linux

How to delete file from folder and subfolder currently using below command for delete logs but i want delete logs file in folder and subfolder in Linux .

currently i am doing enter every folder and delete log for specific year. is there any command for delete same file from folder and subfolder in linux

volumes/abc/http.log2019-07-09
volumes/cdf/http.log2019-07-09

i want single command for delete files all folders in Linux

Currently using below command for delete file

sudo rm http.log2019*
like image 935
Addi Khan Avatar asked Jan 25 '26 03:01

Addi Khan


1 Answers

You can use "find" command with "delete" option. This will remove files with specified name in current directory and sub directories.

find . -name "http.log2019*" -delete
like image 179
Ruchira Nawarathna Avatar answered Jan 27 '26 20:01

Ruchira Nawarathna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!