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 / Easiest way to extract...
Power Automate
Unanswered

Easiest way to extract the contents of many folders?

(0) ShareShare
ReportReport
Posted on by 14

I only need to pull out the files and delete rest

 

there are many folders that that require the same action but if i resurfece them at the same folder i cant sort them out

 

Should i create a new folder for each?

 

it goes like 

 

MAX

it has 2 folders 

Cat and Dog

both cat and dog have a folder named food

how can i get the contents of food to cat and dog respectively and delete the rest?

I have the same question (0)
  • Siddhi_N Profile Picture
    27 on at

    Hi @qwe321 

    You can use PAD 'Get files in folder' action and get files path from food folder, output received will be in a list format(Keep include subfolder untoggled). Next loop through this list and use move file action and move %[listname[loopindex]]% element from list to destination folder i.e cat/dog and finally delete the rest using empty folder(food) or delete folder(food) accordingly.

     

    Siddhi_N_0-1668700181223.png

     

  • qwe321 Profile Picture
    14 on at

    But the problem is there are max 1 max 2 max 3 etc etc

    How can i create a file path for each one? That has been bugging me for days.

    Btw every time the name changes but each folder starts with numbers like:

    01 max

    02 david

    03 jack

  • Siddhi_N Profile Picture
    27 on at

    Hi @qwe321 

    If all this folders are being kept in a single folder eg. Desktop

    1. Use PAD action 'Get Subfolders in  folder' to extract all list of folders from source folder(here consider source folder as Desktop) this step is to get folder count in source folder.

    2. loop from 0 to %source_folder_name.Count%

    3. Inside loop use 'Get Subfolders in  folder' with parameters: folder-<Source folder name> FolderFilter-0%LoopIndex+1%* (Note- Here we are using wild character '*' which will just search for prefix and ignore the remaining folder name for eg. loopindex is 1 we will get metadata i.e name, path and other details of all folders starting with 01 in a list format )

    4. Later you can use 'get files in folder' action and get all file path by inserting step 3 output as parameter to this action.

    5. loop through this file path list achieved from step 4 and move them to destination location.

     

    Hope this helps.

     

     

  • qwe321 Profile Picture
    14 on at

    Hello @Siddhi_N 

    I dont think i can use the same file path because every time the new folder has a different name only inside of that folders are same like "dog" "cat and food.

    Or you explained it very good but i am quite new to understand any of that😅 

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 284 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 188 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard