0 Replies Latest reply: May 15, 2014 10:03 AM by MarisaLS _ RSS

    Macro for extracting source file folder?

    MarisaLS _

      Hello,

       

      I'm trying to configure input distribution rules for various projects. Basically, I'm archiving files from various locations into one "Archives" folder.

       

      I've got a following Move action configured with the following Rename instructions, and it's working:

       

      Job ID &[jobid] - Source File Name &[source.name][/CODE]

       

      I'm trying to add one more piece of information to the Rename - but I can't figure out how to get the data. I'd like just the immediate parent folder name of the source file.

       

      Example:

      Source File is C:\SomeProcess\SomeSubFolder\FolderNameIWant\TestInput.txt

       

      I'd like the following to be set as the file name once it's moved:

       

      "Job ID 12345 - Source File Folder FolderNameIWant - Source File Name TestInput.txt"

       

      I've tried using &[source.dir][/CODE] but that retrieves the full path. I've also tried creating a calculated field named FolderName in the corresponding Model that contains "FolderNameIWant" and using &[firstvalue.FolderName][/CODE], but it looks like the firstvalue macro is not supported in input distributions.

       

      Is there a way I can retrieve just the immediate parent folder name of the source file so that I can include that data in the Rename?

       

      I know that I could just set-up a whole bunch of folders under the root archive folder instead, but I'd like to avoid that if possible.

       

      Thanks for any suggestions!

       

      Marisa Seal