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

Moving files which appear in certain OneDrive-Folders depending which name they have

Hi,

 

in my work I use a rocketbook, which sends pdf-files to one certain folder in my onedrive. These pdf-files have different filenames, depending on the headline I gave them in my book. It is a matter of order not to give too many different headlines, and I want flow to move (or copy, if it is a difference) the files to different subfolders.

Most Helpful would be to just analyze a part of the filename (for example until a certain letter appears): "Filename$$.pdf" for example could use just the part from first letter to $$ as a destination folder.

A little less helpful, but practicable would be to use the complete filename, but then I would add a timestamp to the filename when moving/copying.

1. The trigger is "When a file is created" in my opinion.

2. Next step is "Create file" in a different folder.

3. Last step is "Delete file" in the triggered folder.

 

But how can I use a part of the filename in the 2. step for changing the target folder?

 

Thanks in advance,

 

C.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Goodmountain
Frequent Visitor

Hello everybody,

 

I just figured it out, but in a different way:

 

rock2one 01.jpg

 

replace(variables('Dateiname'), '.pdf', ''

 

rock2one 02.jpg

 

 

concat(FormatDateTime(AddDays(convertTimeZone(utcnow(),'UTC','W. Europe Standard Time','yyyy-MM-dd'), -1), 'yyyy-MM-dd'), '.pdf')

I store the name of  the file in a variable and change the output by removing the '.pdf', adding the current date and '.pdf'.

This works Robot Happy

 

If there are any questions, feel free to ask.

 

Greetz, Goodmountain

View solution in original post

4 REPLIES 4
v-bacao-msft
Community Support
Community Support

Hi @Goodmountain ,

 

You could try the following method to configure Flow.

  • Use Split() function to extract the file name half.
  • Then manually configure the folder path and create the file.

Expression reference:

first(split(triggerBody()?['DisplayName'],'$$'))

Image reference:

102.PNG

 

Best Regards,

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

Hi Barry,

 

that'a weird, I receive an error that the first paramter value is not a string...

 

rock2one.jpgI used your expression reference as it is, but it didn't looked like I had to change anything in it.

Why is this expression of type 'Null', the reason can't be the format pdf, am I right?

 

Best regards,

 

Goodmountain

Ok, the mist is getting lighter Robot wink

 

I tried your example, but with a completely different content of "Compose".

It was replaced with 

min(1, 5, 4, 3)

and gave back - surprise - "1".

So, the expression

first(split(triggerBody()?['DisplayName'],'$$'))

gives back 'Null' and the flow stops...

The triggerBody() is completely unknown to me, but it doesn't seem to give back a part of the filename... in fact it sees not to give back anything at all.

The manual (https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#t... doesn't help me with the expression 'DisplayName' or any other possibilities. Is there a more detailed manual, which I did not find yet? Robot Sad

 

Thanks in advance,

 

Goodmountain

Goodmountain
Frequent Visitor

Hello everybody,

 

I just figured it out, but in a different way:

 

rock2one 01.jpg

 

replace(variables('Dateiname'), '.pdf', ''

 

rock2one 02.jpg

 

 

concat(FormatDateTime(AddDays(convertTimeZone(utcnow(),'UTC','W. Europe Standard Time','yyyy-MM-dd'), -1), 'yyyy-MM-dd'), '.pdf')

I store the name of  the file in a variable and change the output by removing the '.pdf', adding the current date and '.pdf'.

This works Robot Happy

 

If there are any questions, feel free to ask.

 

Greetz, Goodmountain

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,229)