 Hello everyone and welcome back to another video. So today's video will be looking again at Power Automate and I've had this question a few times and it's basically revolving around how can you create dynamic folders? And by that, what we want to do in this example is as we want to create a new file on our OneDrive which you can see our directory here, we want to save that in a new or create a new sub folder with today's date and then to place our newly created file within that folder. So it sounds more technical than it is but it's actually really quite straightforward to do this. So what we'll do is jump over to Power Automate. So we're using the cloud version here and I'm just going to create a new flow and I'll just do a instant cloud flow. So this is obviously if it's triggered manually and let's call this manual or actually let's say new folder and then we'll go manually triggered because for us at this moment in time the trigger isn't important but for you you may need to do this as a schedule cloud flow that runs either every day or multiple times per day. So the first thing we're going to do into ours because again we're working somewhat with dummy data but if we go back into our files you can see we've got this new staff list. So for the example we'll simply just use this as our new files content. So the first thing we need to do is obviously get the content from our file. So if we go get content and of course for you you're going to have potentially a more valuable source than just a random file that you've picked but all I'm going to do is navigate to where this file is stored. So new staff list and of course we're still working with OneDrive for Business in this example but you could obviously be extracting your source data from maybe SharePoint or one of many other different directories. The next thing I'm going to do and obviously this is the part where you can now differ and decide how you want to do this but I'm going to initialize a variable with my desired folder name. So to do that we'll set initialize, initialize variable and what I'm going to do is call this maybe folder name. We'll change this to be a string and I'm going to use some dynamic content. So here if you had a static recurring name I can't think of a scenario where you might want to do this because we want it to be dynamic you could obviously just type in here but we're going to be using an expression to do ours and all else is simply going to be is to go format date time and the date time I want to format is UTC now and if I do the brackets you can see so that what this bit will do here is return the date timestamp for the current date and time at the point of running this and I just want to reformat this so it's in a bit more of a consistent format. So for me I'm going to go for lowercase wise to capital M's and to lowercase D's and the big mistake I missed here is I just didn't do these within single quotes so let's just add those in there and what this is going to do is it's going to get the current date and time string and it's going to reformat it so that it's in the format of year, month and then day. If you hadn't noticed or weren't aware obviously you need to make sure you do your months in capital M's because lowercase M's will indicate minutes rather than months and yet and obviously just put this in the single quotations so we know it's a string and select okay and then what we've got here now is this variable is going to produce our folder name for us so it's going to work in a scenario but I'm sure there may be other scenarios where if you're trying to do things more dynamically as in creating more or multiple subfolders within the same flow you may need to rethink how this is done but for example and hopefully your example that you're trying to solve this will be just the solution so once we've got our name we can now go to a new step and this is going to be creating our file so if you go create file go into one drive for business again for us so the folder path for us is going to be the point at which we want to store this subfolder so if we navigate through I can see that yeah these are my folders or existing folders at the same level I wish to save my new one so if we go into my files you'll see that the folders backup central excel and my files match what we see here so to make sure that my newly created folder is at the same level I'm just going to go back one and select the root so this is the level I want it but for you just navigate to whichever folder is the folder you wish your newly created folder to be up here within and all I simply need to do here now is we can see we've got our slash there signaling our root folder I'm just going to click folder name and you can see what it's now going to do is dynamically add or it's going to dynamically look for this path or if it's not available it will just create it for us and then in terms of file name let's just call this new file nice and easily.csb and the file content is just going to be of course the file content from that file we extracted at the top here so this last step here well these last two steps the initialize variable to get our folder name and this section here is all we need to be able to create these dynamic folders so you may have seen videos or tutorials about how you can obviously do a create folder using Power Automate so again there may be scenarios where you need that but for the particular question I've been getting regarding OneDrive this is the solution to hopefully meet your problems so what we're going to do is click save once that's saved we can go into test but before that we'll just once more go back into our My Files so we can currently see backup, central, Excel, My Files what we're expecting to see there is a new sub folder in the format of what we say 2022, 11, 29 and then obviously within that we'll see our new file so what we'll do is just go into test, manually, test and then finally when it's ready you go continue with a few buttons to click here run and then done and hopefully we'll get the green flag or green text we say down this create file one yet we can see it done in two seconds let's now go back into My Files and we can see we've got that newly created folder here and you can see with these little sort of the loading icons or three of them you can see where that folder and then when we go into there you can see we've also got our new file so trying to keep this video nice and concise just to the key points here but I hope that answered your question regarding how to create dynamic subfolders when creating your new files if you did enjoy that video and it answers your question please don't forget to give the video a like not only greatly appreciated by me but does help that all important YouTube algorithm and if it's your first time maybe finding one of our videos or you've watched them in the past and you're still yet to subscribe can I please ask you to consider hitting that subscribe button and also that bell notification button that way you'll be notified of all of our videos as they come out in the future so lastly thank you very much again for watching and we'll see you in the next video