Using variables in filepath

Post Reply
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Using variables in filepath

Post by Terkelsen »

Would it be possible to use a variable as part of a filepath for a folder in Switch?

I have a fixed folder structure for all costumers. The only difference is, that the top folder would be named after the costumer. All files are submitted through a Submit Point and the name of the costumer (which equals the name of the top folder) is supplied as metadata.

I have a specific flow that will be duplicated for each costumer and at different point in this flow I use folders in that same folder structure. Let's say I have this folder structure: Name/Input/Datasource. Rather than change each flow to point to the correct folder, it would be really handy if I could define "Name" as a variable grabbed from the metadata.

I use variables for paths in "Inject Job", but the same syntax doesn't seem to work for a folder path. Any ideas?
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Using variables in filepath

Post by gabrielp »

Sounds like set hierarchy and submit hierarchy would work for you. Within set hierarchy, you can enter variables.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Using variables in filepath

Post by Terkelsen »

I don't think I understand how that would help? What I want is to be able to set the path to a specific folder in my flow, by using variables.
lombert
Member
Posts: 167
Joined: Fri Feb 04, 2011 2:31 pm
Location: Sweden

Re: Using variables in filepath

Post by lombert »

Terkelsen wrote:Let's say I have this folder structure: Name/Input/Datasource. Rather than change each flow to point to the correct folder, it would be really handy if I could define "Name" as a variable grabbed from the metadata.
But if you set the hierarchy and then point it to the root-folder there you want your unique folder, then you get the correct folder structure there? Or is I missing something? :)
Between jobs!
loicaigon
Advanced member
Posts: 362
Joined: Wed Jul 10, 2013 10:22 am

Re: Using variables in filepath

Post by loicaigon »

Hi,

Defining a Hierarchy seems also a good idea to me because you can have you "all the clients" folder basis and create the "per client" subfolder structure based on the metadata. Once that done, you can have another flow that would use a hierarchy entry point on the "all the clients" folder and retain the hierarchy path so you can dispatch the jobs between the appropriate flows.

Unless I misunderstand the request.

Loïc
User avatar
TheCaptain
Member
Posts: 86
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

Re: Using variables in filepath

Post by TheCaptain »

I'm wondering if he means rather than creating Folders, instead he's looking to direct traffic to specific folders that already exist but are nested within a consistent Folder Structure.

So whether the top level folder is called; Nike / Adidas / Puma, the lower levels are always named the same i.e Proof / Artwork / Data.

In this way he needs a variable to point to the lower level of a unique top level.

If this is the case, I believe hierarchy can still complete this task but you would need to specify Regular Expressions style layer arguments to pinpoint a specific item.

This https://www.cheatography.com/davechild/ ... pressions/ may help...
heihei
Newbie
Posts: 3
Joined: Fri Feb 05, 2016 8:43 pm

Re: Using variables in filepath

Post by heihei »

Terkelsen wrote: Mon Sep 19, 2016 12:14 pm Would it be possible to use a variable as part of a filepath for a folder in Switch?

I have a fixed folder structure for all costumers. The only difference is, that the top folder would be named after the costumer. All files are submitted through a Submit Point and the name of the costumer (which equals the name of the top folder) is supplied as metadata.

I have a specific flow that will be duplicated for each costumer and at different point in this flow I use folders in that same folder structure. Let's say I have this folder structure: Name/Input/Datasource. Rather than change each flow to point to the correct folder, it would be really handy if I could define "Name" as a variable grabbed from the metadata.

I use variables for paths in "Inject Job", but the same syntax doesn't seem to work for a folder path. Any ideas?
Did you ever get this to work? I believe I'm trying to accomplish the same result and just cant figure it out. When a job is received I use the metadat to rename the file and create a new job folder. At that time I want to create a set of folders in the job folder. These are the same for every job we do adn are used as the job progresses though production, preflight, proofing, hi res output, mailing, etc.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Using variables in filepath

Post by Terkelsen »

No, I still haven't found a way to use variables in the folder path.

However, I think your challenge is a bit different as you have the metadata to name the folder from. If I understand you correct, I think this can be solved by using the Inject Job element.

Create a folder containing the desired folder structure. Eg. a folder called "Topfolder" containing Folder_1, Folder_2 etc. and maybe some subfolders. Rename the incoming file using the metadata. Now use a copy of this file to trigger the injection of the folder containing the folder structure. When injecting the folder make sure to rename it after the incoming job (If that job has an extension, you will end up with a folder with an extension, which you have to remove using Rename Job).

On the original file (the one you didn't use for the injection) set the Hierarchy Path to be the Jobname Proper. Now direct both files to an Archive Hierarchy. You need to make sure that the new folder structure is in the Archiver Hierarchy before the file comes in. I suggest you simply put the file on hold for a few seconds to ensure that. There might be better ways?

It could all look something like this:
Skærmbillede 2018-09-26 kl. 12.13.19.png
Skærmbillede 2018-09-26 kl. 12.13.19.png (37.85 KiB) Viewed 12951 times
As always with Switch there are probably other ways to achieve the same ;)
r.zegwaard
Member
Posts: 93
Joined: Fri Jul 08, 2011 10:31 am
Location: The Netherlands

Re: Using variables in filepath

Post by r.zegwaard »

Hi Terkelsen,

Could you provide a sample of the folder-structure you need?
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Using variables in filepath

Post by LasseThid »

Hi Terkelsen.
Could this work?
In the set Set hieararchy path you set the number of subfolders you need, the first one based on the Customer name and then in the Archive hierarchy you set the path to the folder before your customer folder.

See attached screenshot where the path set in Archive points to //Volumes/huvudserver/poffordrar (basically the folder in which your customer folders reside).
In the Set hierarchy path I then use the file name to create the next three folder levels and then finally I have a specific folder name for the original files submitted for the job.
In your case Path segment 1 would be where you put the customer name.
Attachments
Hieararchy.jpg
Hieararchy.jpg (125.71 KiB) Viewed 12899 times
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
heihei
Newbie
Posts: 3
Joined: Fri Feb 05, 2016 8:43 pm

Re: Using variables in filepath

Post by heihei »

@Terkelsen

You rock! It works and you elevated my knowledge a ton in figuring it all out!

Thank you,
Sam
Dave23
Member
Posts: 41
Joined: Thu Oct 12, 2017 4:42 pm

Re: Using variables in filepath

Post by Dave23 »

Hi Terkelsen,
Did you ever manage to get anywhere with making the filepath using variables or some kind of work around?
Thanks
Post Reply