Tool for recursive renaming folders and files for your static assets.
RecursiveRenamer.run("path/to/main_folder", "static_assets", [".DS_Store", "README"])
# Path: path/to/main_folder
main_folder
│ README.md
│ image with Spaces.jpg
| .DS_Store
│
└───folder1
│ CssStyle.txt
│
└───subfolder1
│ file111 -- - 0019487.txt
│ ...
# Path: path/to/static_assets
static_assets
│ image-with-spaces.jpg
│
└───folder1
│ cssstyle.txt
│
└───subfolder1
│ file111-0019487.txt
│ ...
- Lowercase path
- Multi empty spaces to dash: " " -> "-"
- Multi dashes and empty spaces to dash: "---- " -> "-"
- Recursive folder creation
- Custom format functions
If available in Hex, the package can be installed
by adding recursive_renamer
to your list of dependencies in mix.exs
:
def deps do
[
{:recursive_renamer, "~> 0.1.0"}
]
end
RecursiveRenamer.run("../source", "name_of_destination_folder")
RecursiveRenamer.run("../source", "name_of_destination_folder", [".DS_Store", "other_string_included_in_the name"])
defmodule MyApplication do
def custom_format(path) do
String.replace(path, "test_", "")
end
end
RecursiveRenamer.run("../source", "name_of_destination_folder", [], &MyApplication,.custom_format/1)
mix rename "../source" "name_of_destination_folder"
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/recursive_renamer.
- Add tests
- Doctests