Can Switch create a specific Folder Structure?

Post Reply
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Can Switch create a specific Folder Structure?

Post 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...
User avatar
Terkelsen
Member
Posts: 126
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Can Switch create a specific Folder Structure?

Post 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.
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

Re: Can Switch create a specific Folder Structure?

Post 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.
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: Can Switch create a specific Folder Structure?

Post by TheCaptain »

Great!

I'll test and report back :idea:
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: Can Switch create a specific Folder Structure?

Post 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?
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Can Switch create a specific Folder Structure?

Post 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.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Post Reply