Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

SFTP - Create File but ignore .txt files

(1) ShareShare
ReportReport
Posted on by 302
I am trying to set up a flow for my SFTP to grab file from one SFTP and Create them in another SFTP.

Only problem I am running into is i am trying to exclude the .txt files. Anyone have any luck doing this?
My condition is if Displayname of the file contains .txt delete the .txt file. But it deletes everything instead and not just the .txt file
 
  • honganhuynh1 Profile Picture
    302 on at
    SFTP - Create File but ignore .txt files
    @Creativeopinion, I created the filter array and the length compose action.

    Would I put the array into a Delete File action now?
  • creativeopinion Profile Picture
    10,439 Super User 2025 Season 1 on at
    SFTP - Create File but ignore .txt files
    Depending on how many files are returned from the List files in folder action. It's always best practice to filter out the files you want to loop through first before you loop through them.
     
    The way your flow is currently structured can be inefficient especially if you have a lot of files since you are looping through every file returned and running a condition check to see if the file matches your criteria. Instead, use a Filter Array action to filter out files that you want to delete. 
    If you aren't familiar with how to use the Filter Array action, check out this YT Tutorial I've linked at the bo. Filter out the files with a .txt extension by using the ends with operator. Tip: Ensure you add a Compose action to return the count of files returned before you continue on with your flow. I demonstrate how to do this in this section of the tutorial.
     
    If you still run into issues after watching the tutorial, ensure that you toggle off the New Designer and click each action to expand it. Upload a screenshot of your flow in edit mode.
     
     
    In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.
    1️⃣ Cross-Referencing Data
    2️⃣ Filtering by Key
    3️⃣ Substring Matching
     
    Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression.
     
    IN THIS VIDEO:
    ✅ 3 Ways to Use the Filter Array Action
    ✅ How to use the Scope Action to Group Actions
    ✅ How to Check the Number of Items returned from a Filter Array Action
    ✅ How to Cross-Reference Data in Excel with a SharePoint List
    ✅ How the Filter Array Action Works
    ✅ How to Access the Dynamic Content from a Filter Array Action
    ✅ How to Filter Items by a Key
    ✅ How to Filter Items by Matching a Substring
    ✅ How to Use Multiple Conditions in a Filter Array Action
     
     
    Hope this helps!

    Consider giving me a ❤️ if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492