This is a mirror of the GitLab repo! https://gitlab.com/Lynnesbian/fif
Find a file
Lynnesbian 129aa83ade
All checks were successful
continuous-integration/drone/tag Build is passing
lots of stuff! and a version bump!! 0u0
- extension_from_path now returns Option<&OsStr>
- two new tests
- Findings uses a Path instead of a PathBuf, reducing allocations
- some unnecessary stuff removed, thanks clippy
- that is all
2021-03-26 04:46:07 +10:00
.idea removed python stuff 2021-03-14 21:55:44 +10:00
src lots of stuff! and a version bump!! 0u0 2021-03-26 04:46:07 +10:00
.drone.yml don't test on alpine since it's currently broken due to a crate out of my control 0uo 2021-03-12 04:05:03 +10:00
.gitignore fixing a problem before it happens 2021-02-28 21:10:31 +10:00
Cargo.lock lots of stuff! and a version bump!! 0u0 2021-03-26 04:46:07 +10:00
Cargo.toml lots of stuff! and a version bump!! 0u0 2021-03-26 04:46:07 +10:00
clippy.sh lots of stuff! and a version bump!! 0u0 2021-03-26 04:46:07 +10:00
Cross.toml windows support! and other stuff 2021-02-20 03:57:36 +10:00
LICENSE better error handling and pattern matching, added license 2021-02-05 15:57:21 +10:00
README.md integration test for arg parsing, minor shuffling around of things 2021-02-28 22:17:26 +10:00
rustfmt.toml removed an unecessary allocation 2021-03-12 02:55:40 +10:00
test.py added a python script for testing and a drone config for CI 2021-02-28 21:08:35 +10:00

fif

Crates.io Crates.io Minimum Supported Rust Version CI Status

A command-line tool for detecting and optionally correcting files with incorrect extensions.

Installation

Default backend

cargo install --locked fif

Other backends

fif supports using infer or 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) 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:

# xdg-mime
cargo install --features=xdg-mime-backend
# infer
cargo install --features=infer-backend

Usage

See fif --help for more.

The basics

The simplest way to use fif looks like this:

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:

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):

fif -E images ~/Pictures > output.sh

More coming soon!