Hi,
I'm new to KM and I don't know how to create folders based on a Prefix (ex: S010A02) and move all the files containing that prefix into a new folder named with the Prefix.
In the screenshot there's an exemple with the first folder manually created.
Many thanks!!!! Screenshot_2021-01-18 22.05.05_kM4toD|690x1066
Moderator Edit: In the future, please just paste, drag-n-drop, or insert via the forum menu all of your images so they appear in the post.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Note that I have NOT done any error checking, which you might want to add.
One good thing is that if the "new" subfolder already exists, it will NOT error -- it will just use that folder.
Many thanks @JMichaelTX, well appreciated.
What I actually need is to create, for each new suffix, a folder.
The trigger would create S010A01 and place all the files containing the prefix S01A01 into it (as the macro you sent me), but also for S010A02, S010A03, S010A02, etc.
Is it possible?
Sorry, I don't have any more time right now. You can just run the Macro for each prefix you need. Further modifications will be left as an exercise for the student. This is the best way to learn.
Try making the mods yourself. If you really get stuck, post back with your Macro and specific questions, and maybe someone can help.
OK @Omar_Tajmouati, here's the revised Macro that will create a sub-folder, and move the file, for ALL files that have a prefix that ends with an underscore _.
Note that this macro can be further optimized to run a bit faster, but it seems to run very fast to me.
•
This will attempt to create the Sub-Folder even if it already exists.
•
Does NOT cause an error
•
Although redundant, seems very fast even if Sub-Folder already exists.
BTW, this is an excellent use case for RegEx, used to extract the Prefix from the file path: \/([^\/]+?)_
For details see regex101: build, test, and debug regex
Before Macro is Run
AFTER Macro is Run
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.