gatlat wrote:I would like to swap the first 2 words of files
and place a comma at the end of the first word.
The files have more than 2 words in them.
The constant between the first 2 words of the file is a space
eg:
Angela Mitchell - 2010-02-22 - DSU9999.pdf
becomes
Mitchell, Angela - 2010-02-22 - DSU9999.pdf
Hi gatlat, welcome.
FROM:
Angela Mitchell - 2010-02-22 - DSU9999.pdf
TO:
Mitchell, Angela - 2010-02-22 - DSU9999.pdf
Use RegEx to match parts of your file name:
1) match word one till an space ==> '(.+)~' ==> should get 'Angela'
Hint: This (...) are capture groups to hold what is found by the RegEx and use it to replace later.
2) match second word till an space ==> '(.+)~' ==> should get 'Mitchell'
3) match the rest of file name ==> '(.+)' ==> should get '- 2010-02-22 - DSU9999'
Use
RegEx(1)
Match: '(.*?)~(.*?)~(.*)'
Repla: \2,~\1\3Don't use this ' -quotes. They are only for explanations.
'?' means non-greedy: stop at first blank, instead of last.
Instead of ~ -signs type an space/blank.
Match: (.*?) (.*?) (.*)
Repla: \2, \1\3
HTH?
If yes: please help two others too.
Tell us how it works.
Note: if your other file names has an other pattern then your example, then this solution may fail.
See this both oldest threads in the "Regular Expressions" forum for an RegEx syntax overview:
=> Getting Started: http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=5
=> Go ahead: http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=27
There you will find more examples and tips.