Page 1 of 1

Can Switch create a specific Folder Structure?

Posted: Thu Aug 11, 2016 12:03 pm
by TheCaptain
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...

Re: Can Switch create a specific Folder Structure?

Posted: Thu Aug 11, 2016 12:13 pm
by Terkelsen
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.

Re: Can Switch create a specific Folder Structure?

Posted: Thu Aug 11, 2016 12:18 pm
by freddyp
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.

Re: Can Switch create a specific Folder Structure?

Posted: Thu Aug 11, 2016 12:29 pm
by TheCaptain
Great!

I'll test and report back :idea:

Re: Can Switch create a specific Folder Structure?

Posted: Fri Aug 12, 2016 2:35 pm
by TheCaptain
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?

Re: Can Switch create a specific Folder Structure?

Posted: Fri Aug 12, 2016 3:42 pm
by gabrielp
TheCaptain wrote:Or is the only option, to throw a file into Switch to start the process running?
This is the core of how Switch works. You need to move files around to process anything within Switch.

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.