Skip to content

TondaHack/recursive_renamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recursive Renamer

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_folderREADME.mdimage with  Spaces.jpg
|   .DS_Store  
│
└───folder1CssStyle.txt
    │
    └───subfolder1file111 -- - 0019487.txt
        │   ...
# Path: path/to/static_assets
static_assetsimage-with-spaces.jpg  
│
└───folder1cssstyle.txt
    │
    └───subfolder1file111-0019487.txt
        │   ...
    

Features

  1. Lowercase path
  2. Multi empty spaces to dash: " " -> "-"
  3. Multi dashes and empty spaces to dash: "---- " -> "-"
  4. Recursive folder creation
  5. Custom format functions

Installation

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

Usage

Simple usage

RecursiveRenamer.run("../source", "name_of_destination_folder")

Ignore files

RecursiveRenamer.run("../source", "name_of_destination_folder", [".DS_Store", "other_string_included_in_the name"])

Own formatters

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 tasks

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.

Todo

  • Add tests
  • Doctests

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages