Hi all,
I have a rename command for removing the first n characters of a file name:
Rename REGEXP PATTERN=".(.*)#{dlgstring|Remove first x characters:}" TO="\1"
Works like a charm.
Now I want to rename leaving the first n characters.
In this case, using '#' for repetition is not an option because I don't know how many characters to remove. Instead, I thought I'd use the regexp quantifier {} to define how many characters to leave. With a fixed number of eg. 7 characters the command would look like this:
Rename REGEXP PATTERN="(.{7}).*" TO="\1" TYPE=dirs
Rename REGEXP PATTERN="(.{7}).*(\..*)" TO="\1\2" TYPE=files
But I can't figure out how to make it work with a variable number:
@runonce:@Set count={dlgstring|Leave first x characters:}
Rename REGEXP PATTERN="(.{{$count}}).*" TO="\1" TYPE=dirs
Rename REGEXP PATTERN="(.{{$count}}).*(\..*)" TO="\1\2" TYPE=files
This doesn't work (it leaves only the first character), presumably because of the nested curly brackets.
Any ideas?
(Yes, of course I could use scripting, but I hope it's not necessary...)
Thanks a lot,
MartO