cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Art of the Possible: Automatic Creation of Properly Named Folder and Contained Files

Hello,

 

I am wondering if Microsoft Flow is capable of a process that I want to automate in OneDrive for Business. Roughly, it is as follows.

  1. Right click on a folder named "Mmm yyyy Data" in OneDrive for Business
  2. Select Flow
  3. Flow processes as follows:
    1. Creates new folder based on next month and updates year if needed, or prompts user for that input via a drop down/calendar
    2. For each Excel file within the old folder, place in new folder with these edits:
      1. (psuedo-code) new file name = left(x) & [three character desired month] & " " & [four digit desired year]
      2. new file content = old file content
      3. (nice to have) executes 'file contents update' macro in Excel [still to be coded]
      4. moves to next file in old folder until all have been processed

Excel file name facts:

  • Examples: "blah blah blah Dec 2018.xlsx" "blah blah blah Jan 2019.xlsx" "blah blah blah Feb 2019.xlsx"
  • The only thing changing is the three character month and four digit year.
  • That's eight characters when you include the space between these.
  • These always occur at the end of the string.
  • So take the length of the original name and subtract 8 to get number of characters to take from the beginning of original file name for the new file name, variable x mentioned in 3.2.1 above.

The above is something that I could figure out how to do with a script to run in Windows; but I'm completely new to Microsoft Flow and just want to know if it's worth my time to pursue this. If folks can point me in the right direction for what they think are the tricky bits or let me know which bits aren't possible, I'd greatly appreciate it.

Warm regards,

Alexa

5 REPLIES 5
Highlighted
Solution Sage
Solution Sage

Hi @Anonymous ,

First of all, there is no action action for you to select a folder in flow.

So you can't get the folder metadata.

Second, there is also no action about create a new folder currently in flow.

However, you get the file in a folder with the action 'List files in folder'.

Then use the 'Copy file' action to copy the file to another folder with the name you want.7.PNG

If you want to learn hwo to rename the file with the next month date, please feel free to feedback.

Best Regards,

Community Support Team _ Zhongys

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

 

Highlighted
Anonymous
Not applicable

@v-zhos-msftah okay, and thank you for your quick reply to my post. This helps a lot and could be workable.

 

How would I start with incrementing the month [and year, if needed]?

Highlighted
Anonymous
Not applicable

Hello @v-zhos-msft and others,

 

I just realized that implementing the "copy files" Flow would be more cumbersome than a simple Ctrl+C and Ctrl+V. If I were to pass it along to someone else, they'd need to: manually create the new folder, hard code the old folder to copy files from, and potentially have trouble with proper renaming. I'd appreciate any further input; but I think I'll move forward with making a script outside of Flow.

 

Thanks,

Alexa

Highlighted
Anonymous
Not applicable

Also, there is a bug in this forum. I've gotten an email that something that I did not mark as the solution was marked as the solution.

 

soln msg.PNG

Highlighted

Hi @Anonymous ,

Sorry for that, I accidentally clicked the ‘Accept as solution’ button.

So you got the solution email.

It seems you want to incrementing the month and year.

Please take a reference of 'Date and time functions' in flow:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#date-and-time-functions

Best Regards,

Community Support Team _ Zhongys

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (9,884)