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 Automate
Unanswered

counting files

(0) ShareShare
ReportReport
Posted on by 14

How do i make a flow that

for each subfolder

loop

looks inside counts how many files there are and creates folders accordingly 

so if a folder has 100 images it will create folder "1"

if a folder has more than 100 but less than 201 it will create a second folder named "2" and put the first 100 files in 1 and rest to 2.

 

Btw each folder ends with xxx photo

xxx - could be any number from 1 to âˆž

so maybe i could use read info?

any help would be great

 

 

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Get folders * to %Subfolders%
    For each %Folder% in %Subfolders%

        Get files from %Folder% to %Files%
        Set variable %TempNumber% as %Folders.Count - 1% ‘this is important for the next step

        Set variable %CalcNumber% as %TempNumber / 100% ‘this will give a 0.something for 99 and under, and a 1.something for 100-199, etc.

        Truncate (or Trim, can’t remember) %CalcNumber% to integer only and save as %TempFolder% ‘this doesn’t round, it just removes the decimal places.

        Set variable %FoldersNeeded% as %TempFolder + 1%

        Loop 1 to %FoldersNeeded% increment of 1

            Create subfolder named %LoopIndex% in %Folder%
        End(Loop)

    End(For each)

     

    for an example of the 4 step math process, we will try 100 and 101 for example. 

    for 100

    we minus 1 to get 99

    Divide by 100 to get 0.something

    truncate to get 0

    add back 1 to get 1

     

    for 101

    we minus 1 to get 100

    divide by 100 to get 1

    truncate will still be 1

    add 1 to get 2

     

    the loop will add a folder for each loop number up to %FolderNumber%.

    good luck!

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

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard