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

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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,124)