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

Duplicate or copy a sharepoint file to new location and rename at the same time

1. I have file name called ReportTemplate.docs from a document library name Reports

2. I want to run a recurring flow every Friday at night to make a duplicate copy of the ReportTemplate.docs with a new filename so for upcoming Monday, the duplicate copy should have a file name 2018-09-24ReportTemplace.docs

 

Thank you for your help.

5 REPLIES 5
v-yamao-msft
Community Support
Community Support

Hi @NBMS_2019,

 

Do you want to move the file from one library to another by adding a timestamp into the file name?

 

To run the flow every Friday at night, please use the trigger Recurrence. For testing, I just use Button to trigger the flow.

 

Then get the specific file and file content that you want to copy using the action Get file metadata and Get file content.

 

Last, Create file into the destination library. In the File name field, use the following code before the dynamic content Display Name:

formatDateTime(addDays(utcnow(),4),'yyyy-MM-dd')

 

It works just fine, please take the following images for a reference and try it on your side.

1.PNG2.PNG

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your reply but the logic changed. 

 

So the new logic is...

- Recurring flow is schedule 5pm every Monday

- Look for a file modified after 12noon that day. For example, next Monday is Sept 24th. Look for the file modified the last 5 hours so if my recurring action is scheduled at 5pm, look for this file modified between 12-5pm. There is always one file being edited by many users every Monday and the last time they can edit it is between 12-5pm on Monday.

- Make a duplicate copy of this file, saving it on the same library with the same filename but with a date inserted for Monday next week which is now October 1 .

 

I appreciate your help. Thank you again.

one.pngIt is blowing up at "Apply to Each" actionIt is blowing up at "Apply to Each" action

 

 

Hello @NBMS_2019 , 

 

I am trying to do something similar but a bit stuck: I want to copy picture files from one folder to another and rename the new file using the source folder names. I do not care if this is triggered when the image files are created or as a recurring flow (daily). 

 

For example: if a picture (with a generic name like "IMG2365.jpg") is added to the nested folders Guatemala > Buena Vista > Installation, I want to create a copy of the picture file. The new file in the destination folder should be named "Buena Vista_Guatemala_Installation" or something like that, and have the same file details (like date created) as the original file.

 

Ultimately I want to copy these to a picture library, but right now I'm just testing outflows in our standard file library. 

 

Can you help me with limiting the copy to image files and renaming using the source folders?

 

Thanks.

kjwolf326
Frequent Visitor

Hello, 

I'm looking to do something similar as well.  I'm looking to have a "Comic of the Day" on my SharePoint modern intranet homepage, and cannot figure out anyway to do this.  I have a new comic for each day, and currently have a unique show by date as a column in a list.  I used a custom view in a list, but it shows much too small as a list view on the page.  I'd ideally like to use the Image Gallery webpart, and have it show a new picture each day.  

 

I'm thinking I'd like to have power automate copy a new file based on "show Date" into an image library, and then change the name to "comic of the day", and replace the existing image in that library.  This would ensure the URL to that picture didn't change, but the actual image/comic would.  Any help or pointers would be MUCH appreciated!!

Thanks

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,396)