Hi.
I have many files named by this pattern:
randomstring - username.jpg
I would like to delete all strings except a username, so final filename should be username.jpg
Length of both, a random string and username are variable.
How can I do it?
delete random string from filename
Moderators: white, Hacker, petermad, Stefan2
Re: delete random string from filename
Hi and welcome, terezava.
like "first space" or "second hyphen" or "last comma",
or "delete first 10 signs" or "keep last 20 signs" or use signs "S"+two digits as anchor.
You have to find a common marker (anchor) on your file names,
like "first space" or "second hyphen" or "last comma",
or "delete first 10 signs" or "keep last 20 signs" or use signs "S"+two digits as anchor.
Re: delete random string from filename
Thank you Stefan2
The dash is common marker. I would like to leave all behind the dash. But I don't know how to do it. I tried Multi-Rename Tool, but I am not able transform such request into the regular expression.
The dash is common marker. I would like to leave all behind the dash. But I don't know how to do it. I tried Multi-Rename Tool, but I am not able transform such request into the regular expression.
Re: delete random string from filename
FROM:
randomst - username 2.jpg
random string - user name.jpg
randomstring - username.jpg
randomstring 3 - user.jpg
TO:
user.jpg
user name.jpg
username.jpg
username 2.jpg
RULE:
remove everything till (single or last occurrence of) SpaceHyphenSpace
MRT:
Search: .+-#
Replace:
[x]RegEx
# is here a marker for an space: ".+- "
randomst - username 2.jpg
random string - user name.jpg
randomstring - username.jpg
randomstring 3 - user.jpg
TO:
user.jpg
user name.jpg
username.jpg
username 2.jpg
RULE:
remove everything till (single or last occurrence of) SpaceHyphenSpace
MRT:
Search: .+-#
Replace:
[x]RegEx
# is here a marker for an space: ".+- "
Re: delete random string from filename
I got it! Thank you very much