Rename a file based on date in file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Rename a file based on date in file Mon Jul 29, 2019 7:15 am • by MichaelTzu
I have searched the forum as sure someone has already asked this.
I want to rename a file of the format
5086583_BR-308212101001_INV_BR-308212101001-20190725_20190725

I can use 5086583_BR-308212101001_INV_BR-308212101001- as supplier ID and use that but not sure how to use last 8 digits of the file name that denotes the invoice date.

Want to end up with Supplier Bill Invoice Date with date formatted as 2019_07_25.

Thanks

Michael
MichaelTzu
 
Posts: 9
Joined: Mon Feb 02, 2015 9:10 am

Re: Rename a file based on date in file Mon Jul 29, 2019 7:43 am • by Dave61
Use "If name matches" with four custom elements. The first "SupplierID" matches the "anything" element, then three more for year, month, and day; the first with 4 digits, the others with 2.

Then use "rename" action with pattern SupplierID[space]Year[Space]Month[Space]Day with the Extension element directly after.

As this stands you will have some unnecessary characters, such as the _ and the repeated date, so you should tweak the match pattern to get rid of them.

PS It took me a few goes to master this, but it was well worth the effort.

PPS I would upload a screenshot but my sharing service is down.
Dave61
 
Posts: 94
Joined: Tue Jul 10, 2012 4:56 pm


Return to Support

cron