I would like to create a cleanup script for a directory used for backups.
For example: I have 10 files in a directory and they include numbering in the file name
such as:
b_100
b_101
b_102
b_103
b_104
b_105
b_106
b_107
b_108
b_109
b_110
I would like to grep for specific files within the directory from b_105 to b_110 and remove all the rest. Meaning b_100 b_101 b_102 b_103 b_104 will all be removed/deleted.
If I would to grep for one file within a directory like b_110 then remove everything not grepped for.
grep
searches content inside files. Did you mean that, or did you mean that you simply wanted to match the files namedb_105
tob_110
and remove the rest? – Chris Davies Sep 22 '16 at 13:09