Skip to content

Rudxain/rpathchk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recursive pathchk

Important

This program doesn't even compile, yet. I've published this for backup purposes, and to allow people to contribute while I work on this

The default behavior (no args) is equivalent to

find . -printf '%f\0' | xargs -0r pathchk -pP

because this

find . -print0 | xargs -0r pathchk -pP

checks all components, but we only want to check basenames

The example shown in the POSIX docs:

find . -exec pathchk -p -P {} +

is slower, because it doesn't batch args

Why

This post by David Wheeler was the "spark" that motivated me to make this. I've read somewhere that he wrote a sanitization program, but I couldn't find it.

The purpose of rpck is to ease the transition to stricter path-name rules, by finding all the paths that may need renaming.

I'm considering to add a configurable auto-fix feature, but that may be too complicated

Usage

Install

This needs a Rust toolchain. Recommended command:

cargo install --path . --config 'build.rustflags="-C target-cpu=native"'

Assuming you've downloaded and cded into the repo

Run

Invoke the program by passing the paths you want to check:

rpck file.txt directory/

Or simply pass nothing, identical to rpck ..

The program will validate the args you pass, as pathchk -pP would. Then, for each directory, it will recursively check all basenames.

Note

I'm considering to print a warning when an arg ends with / but it doesn't exist in the file-system.

You can pass flags to change the rules. The one I recommend the most is -l (length), which allows bypassing the overly-pedantic 14char limit.

etc

This program is single-threaded, as it's IO-bound.

See also

  • This crate. I didn't use it here, because I need more control over the rules

Releases

No releases published

Packages

 
 
 

Contributors