blob: 03c77df6ca509ee7efe2cc2914cd4e4672701435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# bulk_rename
Renames every file in a directory, either to names read from a list file
(one name per line, matched in sorted order) or sequentially via a
`sprintf`-style pattern.
## Usage
```
bulk-rename [options] [DIRECTORY]
```
By default, operates on the current directory and reads target names from
`fileNames.txt` in the parent directory.
```
-l, --list FILE File with one target name per line
(default: fileNames.txt in the parent of DIRECTORY)
-p, --pattern PATTERN sprintf pattern for sequential renaming instead of
a list, e.g. 'wallpaper-%04d' - the original file
extension is kept automatically
-s, --start N Starting number for --pattern (default: 1)
-n, --dry-run Show planned renames without doing them
-f, --force Overwrite existing files at the target name
-h, --help Print this menu
```
### Examples
Rename every file in the current directory to sequential wallpaper names,
starting at 1, previewing first:
```
bulk-rename --dry-run --pattern "wallpaper-%04d" ~/pics/wallpaper
bulk-rename --pattern "wallpaper-%04d" ~/pics/wallpaper
```
Rename from an explicit list instead of the default `../fileNames.txt`:
```
bulk-rename --list ~/episode-titles.txt ~/vids/some-show
```
## Building and installing locally
```sh
gem build bulk_rename.gemspec
sudo gem install ./bulk_rename-*.gem
```
|