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 / Moving document and fo...
Power Automate
Unanswered

Moving document and folders within document library across any levels

(0) ShareShare
ReportReport
Posted on by 4

Hi All,

 

I have a requirement to copy documents and folders/subfolders across any levels within a document library.

Have a JSON variable source and destination. Destination path usually doesn't exist, hence using Create New folder action to create that path first. 

 

Issue I am facing is documents/folders gets copied successfully to the destination, however nested folders/files come outside and gets copied in parent folder as well. Any idea where I m going wrong? Below is my flow screenshot.

 

Kumarrl2022_0-1669307048975.png

 

 

 

Kumarrl2022_1-1669307048972.png

Categories:
I have the same question (0)
  • v-chengfen-msft Profile Picture
    on at

    Hi @Kumarrl2022 ï¼Œ

    Could you please tell me:
    1. Which Action did the first Full path get from?
    If it is obtained from [Get files (properties only)], the full path of the file should be obtained.

     

    Do you want to move a certain folder to the newly created folder?
    Here is a test for your reference:

    Here are the folders and files that need to be moved:

    vchengfenmsft_0-1669347528526.png

    This is the parent folder of the target folder:

    vchengfenmsft_1-1669347621471.png

    Here is flow:

    I assume you are using the path of [Get files (properties only)], it is recommended to use Folder path here.
    The contents of the Folder path cannot be used to populate, we need to make some modifications.

    slice(items('Apply_to_each_2')?['{Path}'],0,-1)

    vchengfenmsft_2-1669347637203.png

    vchengfenmsft_3-1669347646191.png

    Here is result:

    vchengfenmsft_4-1669347670919.png

    Best Regards

    Cheng Feng

     

     

     

  • Kumarrl2022 Profile Picture
    4 on at

    Hi @v-chengfen-msft 

     

    Thanks for your response. If the source folder as per above example "/Documents/Test/A" contains both documents as well as folder/subfolders, will the above flow work?

     

    1. Which Action did the first Full path get from?
    If it is obtained from [Get files (properties only)], the full path of the file should be obtained.

    [Ian]: Under the Copy action, Destination folder full path was grabbed from Create New Folder full path and Folder to Copy was grabbed from Get Files (Properties only) full path. Please let me know if I am doing wrong?

  • v-chengfen-msft Profile Picture
    on at

    Hi @Kumarrl2022 ,

    Yes,

    The above flow could move a folder into another folder.

    Thank you for answering my question.
    Judging from the return value of [Get Files (Properties only)], Full path refers to a certain file path, not the path of the target folder.

    vchengfenmsft_0-1669352560842.png

    Best Regards

    Cheng Feng

  • Kumarrl2022 Profile Picture
    4 on at

    Hi @v-chengfen-msft 

     

    I tried the above flow changes as advised by you. It is working fine partially, however now noticed that a parent folder gets copied into the destination child folder and documents at the parent level are not getting copied over. 

     

    Kumarrl2022_0-1669358159379.png

     

    Source Path: /HA/HAA/Risk Management_finals/Nested Risk Management/

    The above flow should move UAT folder and below 3 documents into the destination folder "Nested Risk Management Rename again".

     

    Kumarrl2022_1-1669358473058.png

     

    Destination Path: /HA/HAA/Risk Management_finals/Nested Risk Management Rename again/

     

    Kumarrl2022_2-1669358543603.png

     

     

  • v-chengfen-msft Profile Picture
    on at

    Hi @Kumarrl2022 ,

    Sorry, this is my oversight.
    [I didn't think there were files in your parent folder besides folders]

    Do you want:
    1. Move subfolders and files in a folder to another folder?

    Here is a test for your reference:

    Set[Get files (properties only)] Include Nested Items : No

    [Condition] : Determine whether it is a file or a folder.

    If yes, Use [Copy folder] to copy this folder to destination folder

    If no, Use [Copy file] to copy this file to destination folder

    vchengfenmsft_0-1669361641814.png

    vchengfenmsft_1-1669361707386.png

     

    Best Regards

    Cheng Feng

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