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 / Trigger for when a bat...
Power Automate
Answered

Trigger for when a batch of files are added, then put batch in a new folder

(0) ShareShare
ReportReport
Posted on by 104

Can anyone help me get started with a flow, essentially I want the trigger to be 'When a file is added to a specific folder', but this could happen in a number of different ways;

- User adds single file

- User adds multiple files

- User adds folder (containing multiple files)

 

If we refer to the above scenarios as an 'upload occasion', then I want the flow to add all the file/s from the upload occasion to a new folder and give the folder a unique name.  How is the best way to do this, bearing in mind multiple colleagues could add files at the same time.

 

My current thinking would be something like Tigger to be when a file is added, then following actions would be add all files uploaded in 5 second window from when first file was added by the same user to a new folder and rename folder with GUID.

 

Am I over complicating it or is there better way to do it?

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    You could potentially use When a file is created (properties only) and with the Trigger Settings turn off Split On. This will pick up the files in batches and give you an array of files to work with. I'll do some testing tomorrow with each of your scenarios to see how it goes.

     

    grantjenkins_0-1668177446574.png

     

  • tatmaninov Profile Picture
    104 on at

    Thanks for the suggestion, I have started to play around with it and it seems to work as hoped for in the first two scenarios (User adds single file, User adds multiple files).

     

    In third scenario (User adds folder (containing multiple files)) it does work, but it moves the folder (containing the files) inside the newly created folder, whilst not optimal it is ok.  But then it registers the flow as failed.

     

    My guess is that if the folder has 3 files in side it wants to loop 4 times, 1 for folder and 1 for each file, but once it moves the folder the remaining 3 files are no longer in the original location and register a fail.

     

    In short it does work, but would be nice to eliminate the fail, label on the flow.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    You can use the property IsFolder to check if file or folder, and only move the files.

     

    grantjenkins_0-1668240373820.png

     

    Then once the files are moved, you can delete the folder.

     

  • tatmaninov Profile Picture
    104 on at

    Thanks again @grantjenkins for your help, this is now solved.

     

    I implemented your suggestion with the trigger, then to ensure I cover all possible eventualities (I thought of an extra one (user adds folder with files and adds file outside of the folder)) I do the following;

    Filter array for folders, then move and rename the folder/s.

    Then filter array for files (not in a sub folder), create folder and move that.

    tatmaninov_0-1668343047221.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 600

#2
Valantis Profile Picture

Valantis 453

#3
11manish Profile Picture

11manish 356

Last 30 days Overall leaderboard