cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dhan3105
Regular Visitor

Remove Dates from file name

Hi Expert,

 

I’m very new to power Automate. Trying to automate deleting the date time from file. Currently I have daily 20 csv file along with date time. 

c:\document\test

The Filename of the attachment is

 

filename202108150823.csv

filename1202108150823.csv

filenametwo202108150823.csv

filenamethree202108150823.csv

filenamefour202108150823.csv

 

etc…

Would we be able to remove the date and just have

filename.csv ?

filename1.csv

filenametwo.csv

filenamethree.csv

filenamefour.csv

etc….

could you also send me the screenshot of flow, please

 

Any help would be appreciated.

4 REPLIES 4
eric-cheng
Solution Sage
Solution Sage

Hi @dhan3105 ,

 

Will the date portion always be 12 characters long?

 

You could refer to this post to remove the last characters from a string.

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

 

 

dhan3105
Regular Visitor

Thanks @eric-cheng  ,

Appreciate your comment. 
Below is flow I created, not sure where I'm going wrong.

dhan3105_1-1629748269853.png

Expression I used in Compose : 

concat(substring(outputs('Varfilename'),0, sub(length(outputs('Varfilename')), 12)), '.csv')

My input file Name in Sharepoint folder is 

Application202108150823.csv

Address202108150823.csv

Basically I want delete the datetime from original file name, 
I expecting below output using above flow:

Application.csv

Address.csv

 

 

@dhan3105 

Assuming that the date string will always be 12 characters, my example below should work - note that I use 16 rather than 12 to account for the file extension.

image.pngimage.png

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
dhan3105
Regular Visitor

Thanks @ScottShearer ,

Thanks for valuable information, How the flow work on daily basis as the file Name file change every day with datetimestamp
For Example 
Application202108230823.csv - Todays File

Application202108240823.csv - Tomorrow's file. likewise 

Within folder i have 11 different files with datetime. I have to trigger this flow everyday., as soon I dump my daily files into share point folder. 
Many Thanks

Dhan3105

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,116)