Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrw/cmd-all-files
Run a command on every file in a directory
https://github.com/adrw/cmd-all-files
Last synced: about 2 months ago
JSON representation
Run a command on every file in a directory
- Host: GitHub
- URL: https://github.com/adrw/cmd-all-files
- Owner: adrw
- License: gpl-3.0
- Created: 2020-10-04T21:11:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T01:49:44.000Z (about 3 years ago)
- Last Synced: 2024-10-19T19:59:27.885Z (3 months ago)
- Language: Shell
- Size: 22.4 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmd-all-files
Run a command on every file in a directory
## Install
Run the following to install the executables to your `/usr/local/bin` directory and make them accessible to your Terminal shell.
```
$ curl -s https://raw.githubusercontent.com/adrw/cmd-all-files/main/install.sh | bash -s
```## cmd-all-files Usage
- `$1` input directory
- `$2` file extension of the files in directory to iterate over with the command
- `$3` command to run on each extension
- `FP` placeholder in command for the complete file path to the resource in directory
- `BN` placeholder in command for the basename with no file extension```
$ cmd-all-files [directory] [dot prefixed file extension] [command]
```## Test
```
$ cmd-all-files ./test-input .webp "echo FP -o ../new/BN.jpg"
```## Example & webp2jpeg
Convert all webp to jpeg using [`brew install webp`](https://www.majilesh.com/convert-webp/) tool.
```
$ brew install webp
$ cmd-all-files ./test-input .webp "dwebp FP -o ./test-output/BN.jpg"
```Or use the included utility that also is installed with the above script that converts all webp images in the current directory to jpeg.
```
$ webp2jpeg
```