https://github.com/purarue/exists
pipe to test if files exist
https://github.com/purarue/exists
cli file pipes
Last synced: 7 months ago
JSON representation
pipe to test if files exist
- Host: GitHub
- URL: https://github.com/purarue/exists
- Owner: purarue
- License: mit
- Created: 2020-04-26T13:37:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T23:14:23.000Z (11 months ago)
- Last Synced: 2025-02-28T10:44:37.388Z (7 months ago)
- Topics: cli, file, pipes
- Language: C
- Homepage:
- Size: 29.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# exists
Got tired of doing `xargs -I {} sh -c "[ -e \"{}\" ] && echo \"{}\""` to check if a files exist while trying to script things.
This receives paths from standard input, and prints any that exist; Works for files, directories and links.
### Install
```
git clone https://github.com/purarue/exists
cd exists
make install
```### Usage
```
Usage: exists [-v] [-h]
Read filepaths from STDIN, prints ones that exist to STDOUT-h show list of command-line options
-v inverts output, prints filenames that don't exist
```### Example
```shell
$ ls
exists exists.1 exists.c LICENSE Makefile README.md
$ { ls -1; echo 'non_existent_file' } | exists
exists
exists.1
exists.c
LICENSE
Makefile
README.md
{ ls -1; echo 'non_existent_file' } | exists -v # print files that don't exist
non_existent_file
```