I am currently trying to build a flow where I list all files in the root folder and then use apply to each to move them to a designated folder depending on which keyword the filename contains. for example, if I have one file named: "(Maths)the knapsack problem" and another named: "(English)the history of the English language" I want the maths-document to go into the maths folder and the English document to go into the English folder.
I am currently lost on how to get the flow to check if the name of the current file in the apply to each contains the keyword and then also if it's a file and not a folder and then moving it to the right folder.
Solved! Go to Solution.
Hello @Pebkac03 ,
I have this figured out! Please follow the steps below to get this working for you.
I used a different split in my file names, i named them like 'English,Test1' using the comma is what we will use to split the string and use that to select which folder the file needs to go to.
Screenshots below are of the flow
If the item is a folder set your 'Yes' condition to do nothing
Then if the item is a file we want to do the following in the 'No' condition
Expression for the Compose step
split(items('Apply_to_each')?['NameNoExt'],',')
Expression for the Set Variable step
first(outputs('Compose'))
Screenshot below of the Switch step
For each folder you want to use to organize you can add a new Case to the switch step which compares the value of the FileType variable to the first part of the file name.
Thanks,
Zach
Hello @Pebkac03 ,
I have this figured out! Please follow the steps below to get this working for you.
I used a different split in my file names, i named them like 'English,Test1' using the comma is what we will use to split the string and use that to select which folder the file needs to go to.
Screenshots below are of the flow
If the item is a folder set your 'Yes' condition to do nothing
Then if the item is a file we want to do the following in the 'No' condition
Expression for the Compose step
split(items('Apply_to_each')?['NameNoExt'],',')
Expression for the Set Variable step
first(outputs('Compose'))
Screenshot below of the Switch step
For each folder you want to use to organize you can add a new Case to the switch step which compares the value of the FileType variable to the first part of the file name.
Thanks,
Zach
Thank you, this will make my studies so much easier!
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
User | Count |
---|---|
88 | |
57 | |
42 | |
37 | |
33 |
User | Count |
---|---|
86 | |
71 | |
61 | |
56 | |
40 |