remove the content in directory and subdirectory hierarichally with out distroy the directory structure
- by user3713876
In shell script,
I want to clear only text files and log files in the following structure with out removing the directory as well as subdirectories
|
|------bar/
|
|---file1.txt
|---file2.txt
|
|---subdir1/
| |---file1.log
| |---file2.log
|
|---subdir2/
|---image1.log
|---image2.log
I am using rm -rf /bar/* so I am getting the result as follows.
|------bar/
but I want the output like following
|
|------bar/
|
|
|
|
|---subdir1/
|
|
|
|---subdir2/
I want to remove only text files or log files or csv with out removing the directory and the subdirectories