[][src]Crate nflz

Library to handle "numbered (ascending) filenames with leading zeros" It provides the functionality to fetch all files in a given directory, that match the pattern <prefix>(<number>)<suffix), like paris (101).jpg. The library can provide you the following functionality:

  • paris (1).png => paris (001).png
  • paris (2).png => paris (002).png
  • ...
  • paris (31).png => paris (031).png
  • paris (100).png => paris (100).png

Enums

NFLZError

Functions

can_rename_all

Verifies that all files can be renamed without conflict.

compute_rename_map

Compute the rename map. This is a mapping from original file name to the name it would rename the file in the next step. It avoids unnecessary renames (oldname == newname).

get_matching_files

Reads all matching files from the specified directory with a depth of 0, i.e. it only look for files in subdirectories.

rename_all

Renames all files according to the mappings in the rename map if can_rename_all returns Ok.