Page 1 of 1

Cmdline Utility - Remove all characters after hyphen

PostPosted: Mon Jul 30, 2012 7:06 am
by Stbluesrul
I have a directory that is full of folders that are named like so: (names are just an example, actual will be different)

Folder1-whatever
Folder2-whatever
Folder3-whatever
Folder4-whatever

I was hoping to use the command line utility to rename these to:

Folder1
Folder2
Folder3
Folder4

Folder* and "whatever" will always be different lengths. Basically, I'm just looking to chop of the "-" and everything after that. Is the command line utility capable of doing that? I've been looking at the manual and I'm not sure I see a way to do that.

Thanks.

BRC Remove hyphen and remaining text

PostPosted: Thu Jul 10, 2014 2:13 pm
by truth
Remove all text starting with final-hyphen:
brc32 /nofiles /regexp:(.+)-.*:\1
a-b-c-d -> a-b-c

Remove all text starting with 1st-hyphen:
brc32 /nofiles /regexp:(.+?)-.*:\1
a-b-c-d -> a