Search code examples
linuxdockerwindows-subsystem-for-linuxdocker-volumesuperuser

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*

Solution

  • 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