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 / Copy the file to the f...
Power Automate
Answered

Copy the file to the folder

(0) ShareShare
ReportReport
Posted on by 205

Greetings my friend.

 

I have a problem, I can't figure out how I should set up my stream correctly?

 

I want to take a jpg file and copy it to the first folder,
then take another jpg file and copy it to the next folder,
and so on.

 

111.png

 

Can I copy:

 

Folder.GetSubfolders Folder: $'''C:\\Users\\Windows_10\\Desktop\\сортированные для XN''' FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders_12
Folder.GetFiles Folder: $'''C:\\Users\\Windows_10\\Desktop\\картины для описания — копия''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.FullName SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
LOOP FOREACH CurrentItem_Folders_12 IN Folders_12
 LOOP FOREACH CurrentItem IN Files
 File.Copy Files: CurrentItem Destination: CurrentItem_Folders_12 IfFileExists: File.IfExists.DoNothing CopiedFiles=> CopiedFiles
 EXIT LOOP
 END
END

 

Please show me how correctly I should do it?

  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @absentia8 

     

    Try this design. I hope this would helps !

     

    Folder.GetSubfolders Folder: $'''C:\\Users\\Windows_10\\Desktop\\сортированные для XN''' FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders_12
    Folder.GetFiles Folder: $'''C:\\Users\\Windows_10\\Desktop\\картины для описания — копия''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.FullName SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem_Folders_12 IN Folders_12
    END
    SET folderindex TO 0
    LOOP FOREACH CurrentItem IN Files
     IF folderindex = (Folders_12.Count - 1) THEN
     SET folderindex TO 0
     ELSE
     Variables.IncreaseVariable Value: folderindex IncrementValue: 1
     END
     File.Copy Files: CurrentItem Destination: Folders_12[folderindex] IfFileExists: File.IfExists.DoNothing CopiedFiles=> CopiedFiles
    END
    

     

    Flow

    Nived_Nambiar_0-1697562694379.png

     

    Nived_Nambiar_1-1697562709286.png

     

     

    This flow reset the index to zero when it has reached the maximum count of folder, and it will try to move images to first folder , second again.

     

    Hope this helps !

    interesting question, thanks for sharing !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @absentia8 

     

    I think I have missed one point 

     

    Place the copy file action before if condition in the loop 

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 425

#2
11manish Profile Picture

11manish 323 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard