Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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?

  • tatmaninov Profile Picture
    104 on at
    Re: Trigger for when a batch of files are added, then put batch in a new folder

    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

     

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: Trigger for when a batch of files are added, then put batch in a new folder

    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
    Re: Trigger for when a batch of files are added, then put batch in a new folder

    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.

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: Trigger for when a batch of files are added, then put batch in a new folder

    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

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1