75lb / renamer

Rename files in bulk.
MIT License
529 stars 30 forks source link

Windows: wrong behavior when using regular expression #14

Closed tytskyi closed 9 years ago

tytskyi commented 9 years ago

Initial folders structure

.
├── aaa
│   └── aaa_inner
├── bbb
│   └── bbb_inner
├── ccc
│   └── ccc_inner

I run

renamer --find --regex * --replace 1 'aaa/**/*'

I got

.
├── 1
│   └── ccc_inner
├── aaa
│   └── 1
├── bbb
│   └── bbb_inner

I expected

.
├── aaa
│   └── 1
├── bbb
│   └── bbb_inner
├── ccc
│   └── ccc_inner
75lb commented 9 years ago

your command syntax is wrong.. try this

$ renamer --replace 1 'aaa/**/*'

or

$ renamer --replace {{index}} 'aaa/**/*'
tytskyi commented 9 years ago

I'm not sure it is the thing that i need. So i just want to rename any file or folder recursively to one character (in my example was 1). Could you suggest me right syntax?

75lb commented 9 years ago

with this directory structure:

$ tree
.
├── aaa
│   └── one
├── bbb
│   └── two
└── ccc
    └── three

this command:

$ renamer --replace 1 '*/*' -d

produces this dry run output:

Dry run
✔︎ aaa/one -> aaa/1
✔︎ bbb/two -> bbb/1
✔︎ ccc/three -> ccc/1

and when run without dry-run, it produces this directory structure:

$ tree
.
├── aaa
│   └── 1
├── bbb
│   └── 1
└── ccc
    └── 1