Recursive rm with condition in Linux
- by zengr
I have the following folder structure:
parent
- folder1
- main1.x
- main1.y
- main1.z
- main1-626262.x
- main1-626263.x
- main1-626264.x
- main1-626265.x
- main1-626266.x
- main1-626267.x
- folder2
- main2.x
- main2.y
- main2.z
- main2-726262.x
- main2-726263.x
- main2-726264.x
- main2-726265.x
- main2-726266.x
- main2-726267.x
Now, I want to remove: main-*********.x
So, my required folder structure:
parent
- folder1
- main1.x
- main1.y
- main1.z
- folder2
- main2.x
- main2.y
- main2.z
So, how can I achieve this?