https://github.com/jeremywrnr/modname
recursively batch rename files w/ regex
https://github.com/jeremywrnr/modname
file-manager gem regex ruby
Last synced: about 1 year ago
JSON representation
recursively batch rename files w/ regex
- Host: GitHub
- URL: https://github.com/jeremywrnr/modname
- Owner: jeremywrnr
- Created: 2015-12-03T05:14:47.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-06-07T00:26:18.000Z (about 3 years ago)
- Last Synced: 2025-04-20T22:02:58.382Z (about 1 year ago)
- Topics: file-manager, gem, regex, ruby
- Language: Ruby
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
modname
=======
[](https://badge.fury.io/rb/modname)
[](http://jeremywrnr.com/mit-license)
## about
a versatile file naming tool.
easily rename groups of files with regex replacements.
also supports easily changing file extensions.
## setup
[sudo] gem install modname
## usage
```
modname [options] [transform]
modname | rename files, fast
-e | change file extensions
-f | force run; don't pre-check
-r | run modname recursively
-h | show more help, examples
commands
file names
atch] [trans] => modify a pattern in filenames
atch] => delete a pattern from filenames
extensions (-e)
[old] [new] => move file extensions, to
[ext] => lowercase one extension type (EXT => ext)
nil => move all extensions to lower case
examples
file names
modname hello => deletes 'hello' from all filenames
modname hello byebye => replace 'hello' with byebye
extensions (-e)
modname -e txt md => move all txt files to markdown
modname -e mov mp4 => move all mov files to mp4
Note: [optional]
```
### examples
modname -e jpeg jpg # change all jpeg file exts to jpg
modname -e # change all file extensions to lowercase
modname '(.*)' 'jeremy \1' # use grouping to prepend string
## development / testing
To build from source, first install the project dependencies. This project
uses `bundler`, the standard ruby gem management system. If you don't have it,
try running `gem install bundler`. Once that is done:
bundle install
Now, we should be able to build the gem locally. This will build the local
modname gem and link it in your path, so you can playing around with `modname`.
rake build
This uses `rspec` and `rake` to run a suite of unit tests. To run the suite:
rake
## todos
- only try to rename filenames, not folders on recursive calls
- figure out whats up with the extension globbing
- apply optionally to directories as well