https://github.com/gyumeijie/findx
simple extension of the `find` command, but more easy to use.
https://github.com/gyumeijie/findx
cli command-line-tool extension find finder shell wrapper
Last synced: over 1 year ago
JSON representation
simple extension of the `find` command, but more easy to use.
- Host: GitHub
- URL: https://github.com/gyumeijie/findx
- Owner: Gyumeijie
- Created: 2018-10-21T15:03:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-17T12:58:16.000Z (about 7 years ago)
- Last Synced: 2025-03-10T00:58:08.880Z (over 1 year ago)
- Topics: cli, command-line-tool, extension, find, finder, shell, wrapper
- Language: Shell
- Homepage: https://www.npmjs.com/package/findx
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# findx [](https://opensource.org/licenses/MIT)
The `findx` is a **wrapper** of the `find` command, and extents the `find` some way for easy use.
# Install
```bash
$ npm install -g findx
```
or
```bash
$ git clone https://github.com/Gyumeijie/findx.git
$ cd findx
$ ./install
```
> Using `npm` is recommended, for it is easy to uninstall and upgrade.
# Usage
Currently, `findx` extents the `-exec` of `find`.
```bash
findx /path/to/find -exec 'cmd1, cmd2, cmd3;' -exec 'cmd4, cmd5;'
```
command can reference each matched file by `$file`. Use `,` to separate command, and `;` or `\;` to terminate(`;` is recommended).
> Caveat: please use `' '` to enclose commands instead of `" "`. :exclamation::exclamation::exclamation:
For example, give `/tmp/test/find` has the following structure:
```
.
├── example10.jpg
├── example1.jpg
├── example2.jpg
├── example3.jpg
├── example4.jpg
├── example5.jpg
├── example6.jpg
├── example7.jpg
├── example8.jpg
└── example9.jpg
```
Take as an example changing the suffix of these files to `png`, with **findx** we can do this:
```
findx /tmp/test/find -name "*.jpg" -exec 'name=${file%.*}, mv $file ${name}.png;'
```
```
.
├── example10.png
├── example1.png
├── example2.png
├── example3.png
├── example4.png
├── example5.png
├── example6.png
├── example7.png
├── example8.png
└── example9.png
```
# Guide
Theoretically, we can use **any valid shell commands** inside `-exec`, but we don't recommand writing a string of commands in this way, the preferred way is to use a shell script file which includes these commands.