Help with renaming a file

Advanced Renamer forum
#1 : 15/05-18 19:36
Charlie
Charlie
Posts: 1
New to this and need some help

My options are File Pattern Renamer or Regular Expression Renamer.

I need to rename
IES3210_05142018.xlsx

to

IES310(date).txt

I need help removing the _

I would expect the date would be written as ${date yyyy-MM-dd}
Thanks again for the help


15/05-18 19:36
#2 : 15/05-18 22:26
D.Ach
D.Ach
Posts: 35
Reply to #1:

#1, choose "List Replace" method

"_" to "("

"xlsx" to "txt"
(you can add other file extensions to the list if they vary, .doc to txt; .html to txt; etc.)

set to "Name and Extension"
_______________________________________

#2, also choose "Add" method

")"

blank

check "backwards"
set to "Name"
_______________________________________
No quotes on any of the above
_______________________________________

"accept extension change warning"


15/05-18 22:26 - edited 15/05-18 22:36
#3 : 15/05-18 22:36
Mark
Mark
Posts: 174
Reply to #2:
What about re-ordering the date to yyyy-MM-dd?


15/05-18 22:36 - edited 15/05-18 22:42
#4 : 15/05-18 22:42
Mark
Mark
Posts: 174
Reply to #1:
Try this ....

Replace Method
Text to be replaced: (.*)([_])(\d\d)(\d\d)(\d\d\d\d)(.*)
Replace with: \1(\5-\3-\4).txt
Occurrence: All
Case sensitive: Not ticked
Use regular expressions: Ticked
Apply. to: Name and extension

Take

Text to be replaced: (.*)([_])(\d\d)(\d\d)(\d\d\d\d)(.*)

This is effectively creating 6 groups; the text up to the "_", the "_", the month, day, year, the rest including the extension. Note that the "( )" define the groups.

Then

\1(\5-\3-\4).txt

Rebuilds the name and extension using your format IES310(date).txt which is taken to be IES310(YYYY-MM-DD.txt. Note that the "-" and "( )" here are purely text, the groups are the "\1" etc.



15/05-18 22:42 - edited 15/05-18 22:44
#5 : 15/05-18 22:44
D.Ach
D.Ach
Posts: 35
Reply to #3:

Oops sorry, I see now.
I'd have to see if I could work out the date format without RegExp (not good at RegExp).


15/05-18 22:44 - edited 15/05-18 22:46
#6 : 15/05-18 23:14
Mark
Mark
Posts: 174
Reply to #5:
I think our posts have crossed!


15/05-18 23:14
#7 : 16/05-18 14:12
D.Ach
D.Ach
Posts: 35
Reply to #6:

Hey Mark,
What do you mean, crossed? I saw your post before I posted.
I was referring to an 'alternate' solution without RegEx.


16/05-18 14:12
#8 : 16/05-18 14:51
Mark
Mark
Posts: 174
Reply to #7:
Ah! Sorry, again :)

Yes, it would interesting to see such a solution .... probably use the <Substr:> to swap the date order from MM-DD-YYYY to YYYY-MM-DD

Assuming the format:

IES3210_05142018.xlsx

The "_" can be used ....

<Subtr:"_":5:3>

Or use <RSubstr

See https://www.advancedrenamer.com/user_guide/compl ete_guide

Hopefully, Charlie will get back to us .....


16/05-18 14:51
#9 : 17/05-18 09:51
Mark
Mark
Posts: 174
Reply to #8:
Or use the Move method!


17/05-18 09:51