I feel like I'm being a numptie but is there a way to have Switch itself create a specific folder structure?
I've got endless Applescripts that do the job, but is there a Switch Flow Element that does the same thing... Hierarchy of somesort?
(NOT using the Scripting Module)
Structure along these lines :
01-PDFs
>High Res
>Low Res
02-Financial
etc...
Can Switch create a specific Folder Structure?
- TheCaptain
- Member
- Posts: 62
- Joined: Mon Jan 18, 2016 4:22 pm
- Location: London
Re: Can Switch create a specific Folder Structure?
You can use the "Set hierarchy path" to create the folder structure.
Set "Path segment 1" to "01-PFDs" and "Path segment 2" to "High Res" and pass the files on to an "Archive hierarchy" with the levels of subfolders set to at least 2.
If you pass a file through this flow, the file will be placed in "01-PDFs -> High Res" in case this folder structure already exist, and if it doesn't, Switch will create it.
Set "Path segment 1" to "01-PFDs" and "Path segment 2" to "High Res" and pass the files on to an "Archive hierarchy" with the levels of subfolders set to at least 2.
If you pass a file through this flow, the file will be placed in "01-PDFs -> High Res" in case this folder structure already exist, and if it doesn't, Switch will create it.
Re: Can Switch create a specific Folder Structure?
Indeed, archive of some sort: "Archive hierarchy". The folder structure into which the job is written is defined by the [Job.Hierarchy] variable. So what you have to do is make sure that this variable has the correct elements (01-PDF's;High Res or 01-PDF's;Low Res or 02-Financial etc.). There are two ways to change that variable:
- some elements (folders, mail receive, ftp receive, submit hierarchy, ...) have a property called "Attach hierarchy info".
- the element "Set hierarchy path".
(Well, there are four, because you can also set the hierarchy using a script expression or script)
When the job hits "Archive hierarchy" and there is a path in [Job.Hierarchy] Switch will create that path if not already there, starting from the root of "Archive hierarchy", and put the job there.
- some elements (folders, mail receive, ftp receive, submit hierarchy, ...) have a property called "Attach hierarchy info".
- the element "Set hierarchy path".
(Well, there are four, because you can also set the hierarchy using a script expression or script)
When the job hits "Archive hierarchy" and there is a path in [Job.Hierarchy] Switch will create that path if not already there, starting from the root of "Archive hierarchy", and put the job there.
- TheCaptain
- Member
- Posts: 62
- Joined: Mon Jan 18, 2016 4:22 pm
- Location: London
Re: Can Switch create a specific Folder Structure?
Great!
I'll test and report back
I'll test and report back

- TheCaptain
- Member
- Posts: 62
- Joined: Mon Jan 18, 2016 4:22 pm
- Location: London
Re: Can Switch create a specific Folder Structure?
Is it possible to invoke the creation of a file structure (as you guys have directed above), WITHOUT inputting a file into Switch?
Say, by a user interaction of some sort.
Or is the only option, to throw a file into Switch to start the process running?
Say, by a user interaction of some sort.
Or is the only option, to throw a file into Switch to start the process running?
Re: Can Switch create a specific Folder Structure?
This is the core of how Switch works. You need to move files around to process anything within Switch.TheCaptain wrote:Or is the only option, to throw a file into Switch to start the process running?
I think if you could use an empty folder as a job, you should be able to use that to submit into a hierarchy giving you what you want. Alternatively, you could drop a dummy file in and have it deleted from the folder (via inject or something). I'm not too familiar with hierarchies, so you may get a better answer from someone else.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix