cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yudistara
Frequent Visitor

Copy all files from one folder to another within same SharePoint library using Flow

I am trying to use FLOW to automate copying files from one folder (say "Current")  to another folder(say "Archive") within the same library.  But it doesn't seem to work. Do I need to use some dynamic formulas here?

 

Please advice. 

2018-04-13_11-28-14.jpg

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yuazh-msft
Community Support
Community Support

 

Hi @ Yudistara,

 

 

Do you want to create a flow to copy the file in folder "Current" to folder "Archive" within the same library once a week?

 

If you would like to use the "Copy file" action if sharepoint connector to achieve your needs, you should fill in the file path in the "Source file path" field and "Destination file path" field of "Copy file" action instead of the folder path.

 

Please take a try use the "Create file"action to achieve your needs,and refer to screenshot below to create the flow to achieve your needs:

Capture.PNGCapture1.PNG

 

 

The expression in the "File Identifier" field of "Get file content" action as below:

items('Apply_to_each')?['{Identifier}']
 
The expression in the "File name" field of "Create file" action as below:
items('Apply_to_each')?['{FilenameWithExtension}']
 

 The flow would run successfully to copy all files from folder "Current" to folder "Archive" as screenshot below:

Capture.PNG

 

 

 

Regards,
Alice Zhang

View solution in original post

OK. I figured it out. Thought i need to share it if someone is looking for the solution. 

 

All I had to do was get the files, set up a condition if the "folder path" contains the name of the folder in which the file needs to be deleted from.  (See below screenshot) and then delete the file.

Delete file.jpg

View solution in original post

5 REPLIES 5
v-yuazh-msft
Community Support
Community Support

 

Hi @ Yudistara,

 

 

Do you want to create a flow to copy the file in folder "Current" to folder "Archive" within the same library once a week?

 

If you would like to use the "Copy file" action if sharepoint connector to achieve your needs, you should fill in the file path in the "Source file path" field and "Destination file path" field of "Copy file" action instead of the folder path.

 

Please take a try use the "Create file"action to achieve your needs,and refer to screenshot below to create the flow to achieve your needs:

Capture.PNGCapture1.PNG

 

 

The expression in the "File Identifier" field of "Get file content" action as below:

items('Apply_to_each')?['{Identifier}']
 
The expression in the "File name" field of "Create file" action as below:
items('Apply_to_each')?['{FilenameWithExtension}']
 

 The flow would run successfully to copy all files from folder "Current" to folder "Archive" as screenshot below:

Capture.PNG

 

 

 

Regards,
Alice Zhang

View solution in original post

Thank you @. It worked perfectly with your instructions. Thanks a lot again. 

 

But now I am trying to figure out how I can delete the file from "Current" folder in our example. Meaning, once the file is copied to Archive folder, the file needs to be deleted from "Current" folder. 

 

I tried using the "Delete file" action, but not successful. Delete file action also deletes the file from both the folders. I only want to delete the file from the Current folder, but not the Archive folder. Any suggestions are appreciated. 

 

Thanks.

OK. I figured it out. Thought i need to share it if someone is looking for the solution. 

 

All I had to do was get the files, set up a condition if the "folder path" contains the name of the folder in which the file needs to be deleted from.  (See below screenshot) and then delete the file.

Delete file.jpg

View solution in original post

Very useful!

Would it be possible to edit the name of the file by adding today’s date at the end of the file name in the destination file path? I imagine it’d be in the Create File step, but what would the expression be? 

Mira_Ghaly
Dual Super User II
Dual Super User II

@yxx 

Expression will be something like this

 

concat(split(filename,'.')[0],utcnow('dd/MM/yyyy'),split(filename,'.')[1])

 

 

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (47,294)