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

I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 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,129 Super User 2025 Season 2 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

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard