fif/README.md

58 lines
1.9 KiB
Markdown
Raw Normal View History

fif
===
2021-02-21 16:15:35 +00:00
[![Crates.io](https://img.shields.io/crates/v/fif.svg?style=flat-square)](https://crates.io/crates/fif)
[![Crates.io](https://img.shields.io/crates/l/fif.svg?style=flat-square)](https://git.bune.city/lynnesbian/fif/src/branch/master/LICENSE)
2021-02-27 02:43:15 +00:00
![Minimum Supported Rust Version](https://img.shields.io/badge/msrv-1.43.0-orange?style=flat-square)
[![CI Status](https://drone.bune.city/api/badges/lynnesbian/fif/status.svg?style=flat-square)](https://drone.bune.city/lynnesbian/fif)
2021-02-21 16:15:35 +00:00
A command-line tool for detecting and optionally correcting files with incorrect extensions.
## Installation
2021-02-27 02:43:15 +00:00
### Default backend
```bash
cargo install --locked fif
```
2021-02-27 02:43:15 +00:00
### Other backends
`fif` supports using [infer](https://crates.io/crates/infer) or [xdg-mime](https://crates.io/crates/xdg-mime) as its
backend for looking up file types. By default, xdg-mime will be used on Linux, and infer on all other systems.
xdg-mime should work on any Unixy system with [libmagic/file(1)](https://www.darwinsys.com/file/) installed, although
I've only tested it on Linux. infer should work on any system.
You can override the default backend for your system at compile time like so:
```bash
# xdg-mime
cargo install --features=xdg-mime-backend
# infer
cargo install --features=infer-backend
```
## Usage
2021-02-21 16:08:08 +00:00
See `fif --help` for more.
### The basics
The simplest way to use fif looks like this:
```bash
fif -E images ~/Pictures
```
This command will scan all of the files with extensions used by image files (.jpg, .png, etc) in your `~/Pictures`
directory.
You can also manually specify a set of extensions to use:
```bash
2021-02-21 16:08:08 +00:00
fif -e jpeg,jpg,zip,docx ~/Documents
```
By default, fif will output a bash script that can be used to fix all the files it found with incorrect file extensions.
You might find it useful to output this script to a file (rather than to stdout):
```bash
fif -E images ~/Pictures > output.sh
```
2021-02-27 02:43:15 +00:00
More coming soon!