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 / 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

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