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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Deleting extracted fol...
Power Automate
Suggested Answer

Deleting extracted folder post moving files

(1) ShareShare
ReportReport
Posted on by 12
Hi all, 
 
    Been working on a flow, see image, that extracts zip files from emails then moves those files into their corresponding file location and everything is functioning fine in the flow, but I want the extracted, now empty, folder to be deleted at the end of the flow and cannot seem to get it working. I've got a version where it deletes the original zip file just fine right after the extract folder step, but cannot get it to delete the empty extracted folder. Thanks in advanced for any help.
 
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,429 Super User 2025 Season 2 on at
    Hi,
     
    Can you please share your inputs and outputs of the Delete action you are using
     
    Then please go into a Flow Run, and do the same. Let's make sure that its pointing at the right thing. 
     
    Next, its very possible its locked still. Which means you probably need a Wait action.. anywhere from 1-10 minutes on worse case.
     
     
  • CU21021532-0 Profile Picture
    12 on at
    Hi Michael, 
     
      
           Thanks so much for your response. Edited the flow slightly - put in a 2 m delay but still was an issue so I'm assuming I'm pointing at the wrong thing so now it looks like this at the end: 
     
     
    File Identifier in the delete file 1 block: (pointing at path of "extract folder" block higher up. 
     
    {
      "type": "OpenApiConnection",
      "inputs": {
        "parameters": {
          "dataset": "https://karbonpartnersinc.sharepoint.com",
          "id": "@items('For_each_1')?['Path']"
        },
        "host": {
          "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
          "connection": "shared_sharepointonline",
          "operationId": "DeleteFile"
        }
      }
    }
     
     
    "For each 1" Code View: 
     
    {
      "type": "Foreach",
      "foreach": "@outputs('Extract_folder')?['body']",
      "actions": {
        "Is_item_a_.pdf": {
          "type": "If",
          "expression": {
            "and": [
              {
                "contains": [
                  "@item()?['Name']",
                  ".pdf"
                ]
              }
            ]
          },
          "actions": {},
          "else": {
            "actions": {
              "Delete_file_1": {
                "type": "OpenApiConnection",
                "inputs": {
                  "parameters": {
                    "dataset": "https://karbonpartnersinc.sharepoint.com",
                    "id": "@items('For_each_1')?['Path']"
                  },
                  "host": {
                    "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
                    "connection": "shared_sharepointonline",
                    "operationId": "DeleteFile"
                  }
                }
              }
            }
          },
          "runAfter": {
            "Delay": [
              "Succeeded"
            ]
          }
        },
        "Delay": {
          "type": "Wait",
          "inputs": {
            "interval": {
              "count": 2,
              "unit": "Minute"
            }
          }
        }
      },
      "runAfter": {
        "For_each_2": [
          "Succeeded"
        ]
      }
    }
     
     
     
     
    Here are the inputs / outputs from a flow run for it:
     
    Inputs:
     
    {
        "host": {
            "connectionReferenceName""shared_sharepointonline",
            "operationId""DeleteFile"
        },
        "parameters": {
            "dataset""https://karbonpartnersinc.sharepoint.com",
            "id""/Automations Test/Staging/Documents for Automation Test"
        }
    }
     
    Outputs:
     
    {
        "statusCode"404,
        "headers": {
            "Cache-Control""no-store",
            "Set-Cookie""ARRAffinity=35665453d3dd2700235f44875cd1c8e4e3fbed353a7e69c73c0d74a9f50ea4ad;Path=/;HttpOnly;Secure;Domain=sharepointonline-eus2.azconn-eus2-003.p.azurewebsites.net,ARRAffinitySameSite=35665453d3dd2700235f44875cd1c8e4e3fbed353a7e69c73c0d74a9f50ea4ad;Path=/;HttpOnly;SameSite=None;Secure;Domain=sharepointonline-eus2.azconn-eus2-003.p.azurewebsites.net",
            "Strict-Transport-Security""max-age=31536000; includeSubDomains",
            "X-Content-Type-Options""nosniff",
            "X-Frame-Options""DENY",
            "x-ms-environment-id""default-ef657141-779e-4503-a502-11f856cef57f",
            "x-ms-tenant-id""ef657141-779e-4503-a502-11f856cef57f",
            "x-ms-dlp-re""-|-",
            "x-ms-dlp-gu""-|-",
            "Timing-Allow-Origin""*",
            "x-ms-apihub-cached-response""true",
            "x-ms-apihub-obo""false",
            "Date""Wed, 26 Feb 2025 23:34:39 GMT",
            "Content-Length""384",
            "Content-Type""application/json"
        },
        "body": {
            "error": {
                "code"404,
                "source""default-ef657141-779e-4503-a502-11f856cef57f.13.common.usa002.azure-apihub.net",
                "clientRequestId""e5f101c9-e0e2-4f02-80bb-de30e5a10b6e",
                "message""The response is not in a JSON format.",
                "innerError""The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
            }
        }
    }
     
     
       
     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard