Have a folder with lots of files & directories.
Want to delete all stuff except a particular pattern say "abc*".
Pattern will be in base directory & descending the structure is not required.
Can easily do it with looping or "grep -v", but wondering if there is an elegant solution.
I may be mistaken, but believe that "find" may take subsequent time in making the list & passing it off to the -exec call. Though we have given the maxdepth option.
Directories what i plan to cleanup belong in range of 300GB.
Do correct if mistaken.
---------- Post updated at 03:24 PM ---------- Previous update was at 03:23 PM ----------
Yup, I tried that & was pretty effective.
Limitation being it works with only a single pattern.
Is there a way to make it work for more than 1 pattern?