cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mcnemare1
Helper I
Helper I

Trigger if file exists with with variable (changing) file name

Hey guys, 

 

I'm really stumped on how to start with this, so I am open to suggestions.

 

One of my end user teams, has a folder where they dump .txt files into. 

 

The .txt files have a naming scheme [Todays Date]_Expenses.txt

 

I have been asked to create a flow that will look for [Todays Date]_expenses.txt ; Then convert that into a CSV, and then place that somewhere else on the network. Then there will be a timer to run this everyday at 4PM EST.

 

There is the "IF File Exists Condition" 

 

Is there a way I can add functional variable into the file pathing scheme 

 

or possibly create my own variable in [MM_DD_YYYY] format, and then insert it into the pathing scheme?

 

if file exists power automate desktop.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelAnnis
Super User
Super User

Get Current DateTime to %CurrentDateTime%

Convert date to text custom format MM_dd_yyyy to %FormattedDate% 'ensure the M's are capital...mm stands for minutes.

If File Exists %FormattedDate%_Expenses.txt

    Change Extension .csv

EndIf

 

Good luck.  If change extension doesn't work, you may have to open it in Excel and Save it as a .csv.

View solution in original post

2 REPLIES 2
Henrik_M
Super User
Super User

Nope. You will have to use Get file(s) in folder (which can have a name filter) and then use the content of that list.

MichaelAnnis
Super User
Super User

Get Current DateTime to %CurrentDateTime%

Convert date to text custom format MM_dd_yyyy to %FormattedDate% 'ensure the M's are capital...mm stands for minutes.

If File Exists %FormattedDate%_Expenses.txt

    Change Extension .csv

EndIf

 

Good luck.  If change extension doesn't work, you may have to open it in Excel and Save it as a .csv.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Top Kudoed Authors
Users online (3,125)