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 Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,214)