cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Goodmountain
Level: Powered On

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
Level: Powered On

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

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

4 REPLIES 4
Community Support Team
Community Support Team

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

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.
Goodmountain
Level: Powered On

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

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

Goodmountain
Level: Powered On

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

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
Level: Powered On

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

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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 375 members 5,129 guests
Recent signins:
Please welcome our newest community members: