jenkins archive artifact excluding all subdirectory

user2095591 picture user2095591 · Feb 21, 2013 · Viewed 8.7k times · Source

I have a couple of job in Jenkins that archive artifact from the source tree for another job (some unit tests or alike). I have the current situation :

top_dir
  \scripts_dir
      \some_files
      \dir1
      \dir2
      \dir3
  \other_dir

I would like to archive all that is in "top_dir" including the files in "scripts_dir", but not the subdirectories "dir1, dir2,...", which I do not know the name, that are in "scripts_dir". These subdirs are actually Windows directory joints that point to other places on the disk, and I do not want them to be copied.

How do I achieve this with the inculde/excludes pattern of Jenkins ?

I already tried, having include=top_dir/ , exclude=

**/scripts_dir/*/
**/scripts_dir/*/**
**/scripts_dir/**/*

but it always exculdes the whole "scripts_dir" folder.

Answer

user2095591 picture user2095591 · Feb 22, 2013

Finally, by using brute force, I found that the following expression does exclude all the files in the subdirectories of scripts_dir (whatever symlink or not), then removing these subdirs, while keeping the files directly in scripts_dir :

**/scripts_dir/**/*/*/

Thanks for the help anyway.