Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mboljen/rmkeep
Keep a number of files matching a certain pattern and remove the rest
https://github.com/mboljen/rmkeep
bash-script regex
Last synced: about 1 month ago
JSON representation
Keep a number of files matching a certain pattern and remove the rest
- Host: GitHub
- URL: https://github.com/mboljen/rmkeep
- Owner: mboljen
- License: mit
- Created: 2021-01-24T18:10:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T17:17:32.000Z (6 months ago)
- Last Synced: 2024-06-23T21:50:55.197Z (6 months ago)
- Topics: bash-script, regex
- Language: Shell
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# rmkeep
Keep a number files matching a certain pattern and remove the rest
## Synopsis
```console
$ rmkeep [OPTION]... [REGEX]
```## Description
This script keeps a certain number of files matching the regular expression _REGEX_ and removes the rest. If no specific _path_ is defined, the current working directory will be searched. If no regular expression _REGEX_ is submitted, all files will be matched.
## Options
+ `-p` _path_
Change working directory
+ `-k` _num_
Change number of files to keep (default: 0, i.e. all files will be kept)
+ `-r`
Reverse sort order
+ `-n`
Perform dry run only
+ `-h`
Show this help message
## Installation
Clone the remote repository and change into the local repository:
```console
$ git clone https://github.com/mboljen/rmkeep
$ cd rmkeep
```Use the following command to install this software:
```console
$ make
$ make install
```The default `PREFIX` is set to `/usr/local`. In order to successfully complete the installation, you need to have write permissions for the installation location.
## Contribution
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)