Page 1 of 1
Use wildcards in set hierarchy
Posted: Thu Apr 17, 2014 2:16 pm
by lombert
Hi
I need to find any way to put a file in a folder there I only knew some of the name.
Like this;
Folder is named 123456-1_abcd..
And I only knew the 123456-1 part.
So I tryed to set the hierarchy to that, but then it makes a new folder with that name. How can I match the two?
Use wildcards in set hierarchy
Posted: Thu Apr 17, 2014 4:13 pm
by dkelly
I implemented something similar in Javascript by enumerating the directories and doing partial name matching. Not sure you can do that with Archive Hierarchy directly.
Use wildcards in set hierarchy
Posted: Thu Apr 17, 2014 5:55 pm
by freddyp
No, "Archive hierarchy" will indeed not do this directly. Nor should it. "Archive hierarchy" places the job in whatever path is in the Hierarchy attribute at that point in time. So, what you need to do is make sure that the Hierarchy contains the correct values. It is perfectly possible to do what you want, but it will indeed require a script expression somewhere to add the correct part to the hierarchy path.
Freddy
Use wildcards in set hierarchy
Posted: Thu Apr 17, 2014 9:49 pm
by lombert
Ok. Thanks for the answer.
How can that solution look like? I will always have the first section, in the filename or in the meta data, but the second part is not possible to get until It's time to put the file in the folder.
Use wildcards in set hierarchy
Posted: Fri Apr 18, 2014 8:49 am
by freddyp
Not tested, but here is what the script expression could look like. Of course you will have to set the path to the directory and you may want to return something else when the folder is not there; that is up to you. The script expression goes in a "Set hierarchy path" at the place and with the other settings you require to get the correct path.
var folder = new Dir("/path/to/folder/where/destination/is");
var dirList = folder.entryList("*",Dir.Dirs,Dir.Name);
var destinationFolder = "";
for (var i=0; i<dirList.length; i++) {
if (dirList.startsWith(job.getNameProper()) == true) {
destinationFolder = dirList;
}
}
destinationFolder;
Use wildcards in set hierarchy
Posted: Tue Apr 22, 2014 8:14 am
by lombert
Thanks!
It worked just perfect. I had to rename my files to just the correct "folder name", the first 123456-1 part, then the file finds the right folder (123456-1_abcd)..
If the folder is'n there, the file just lays outside the folders.. But that should not be any problem, the folder should be there.