web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Deleting FTP Directory
Power Automate
Answered

Deleting FTP Directory

(0) ShareShare
ReportReport
Posted on by 52

I don't see any useful info here and not many question in regards of the issue. 

 

So here is my flow:

 

  1. Open secure FTP connection.
  2. List FTP directory (I have defined the exact folder, I want to read all the subfolders in this main folder. This is okay, no issue. I have named the instances as %DirectoryA%. %DirectoryA%'s address follows the directory I defined earlier, which is: /Main folder/Folder A/<whatever subfolder added in here>)
  3. Download folder(s) from FTP. For Folder(s) to download, I use %DirectoryA%. This works.

After step 3, I want to delete all subfolders in %DirectoryA% but I don't see a clear way to do this. 

In the step Delete FTP directory, there are only 2 parameters needed, which is FTP connection and Directory to delete.

I need to be able to delete only the subfolders in Folder A which could be named anything. If i put in /Main folder/Folder A/%DirectoryA%, it will produce error as it would mean that the address is /Main folder/Folder A/Main folder/Folder A/DirectoryA and so on. 

 

Is there a way I can convert %DirectoryA% to text, store it somewhere, and put is as Directory to delete?

 

Or am I complicating something that is actually simple?

I have the same question (0)
  • Verified answer
    laila2021 Profile Picture
    52 on at

    I have to laugh at myself for this. I have been looking at this in a complicated way when the answer is right in front of me. 

     

    So if you have the same issue as me, here is how to delete the subfolders. 

     

    The flow is the same as I described above but when you want to Delete the subfolders without deleting the main folder, you can use the variables created when you List FTP directory. I name the variable as %directoryA% as described above. 

     

    To delete the folders, start with"

     

    For each CurrentItem in %DirectoryA%

             Delete FTP directory and use the %CurrentItem% variable as the Directory to delete.

    End

     

    I hope this helps anyone who's looking to delete subfolders in FTP.

     

     

  • chalx Profile Picture
    3 on at
    You helped me so much! Thanks

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 246 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 176

#3
Haque Profile Picture

Haque 157

Last 30 days Overall leaderboard