Thanks to visit codestin.com
Credit goes to lib.rs

#directory #path #common

commondir

Find the common root directory of a set of paths

1 stable release

1.0.0 May 15, 2024

#1212 in Filesystem

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

16,015 downloads per month
Used in 15 crates (2 directly)

Apache-2.0 OR MIT

11KB
142 lines

CommonDir

Find a common root subdirectory for a set of input paths. Optionally, concatenate the paths which share this common root subdirectory to a new to a new common root.

For example, given:

/my/my/common/path/a.png
/my/my/common/path/b.png
/my/my/uncommon/path/c.png

It finds the common root: /my/my, and the unrooted branches:

common/path/a.png
common/path/b.png
uncommon/path/c.png

If you decide to concatenate a new root directory /new, it will output:

/new/common/path/a.png
/new/common/path/b.png
/new/uncommon/path/c.png

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Dependencies

~165–580KB
~13K SLoC