Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46983

findFiles step result to expose folder of the matched result separately

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins master v2.70 on Ubuntu 14.04
      Jenkins slave on Windows Server 2012 R2
      pipeline-utility-steps 1.4.0

      Some commands may need the folder containing the result, rather than path to the matched result. Consider following example:

      I have a folder c:\tests\xunit with files results1.xml and results2.xml

      then execute a search:

      findFiles('˜tests***1.xml')

      The search will find the results1.xml file and FileWrapper properties would be:

      .name = results1.xml

      .path = tests\xunit\results1.xml

      .directory = false

       

      This feature request is to provide a property with path without file name, e.g.:

      tests\xunit

          [JENKINS-46983] findFiles step result to expose folder of the matched result separately

          Tobin Davis added a comment -

          Can't you use something like this:

          fileList = findFiles(glob: 'tests***1.xml')
          fileDir = fileList[0].path.minus(fileList[0].name)

          I tested it and it works for me.

          Tobin Davis added a comment - Can't you use something like this: fileList = findFiles(glob: 'tests***1.xml' ) fileDir = fileList[0].path.minus(fileList[0].name) I tested it and it works for me.

          Toma Bussarov added a comment -

          Thanks,

          It looks good as a workaround, except in some edge cases where matched filename as a string is also found in the directory path.

           

          Toma Bussarov added a comment - Thanks, It looks good as a workaround, except in some edge cases where matched filename as a string is also found in the directory path.  

            rsandell rsandell
            tomab Toma Bussarov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: