0

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
user2095591
  • 21
  • 1
  • 3

2 Answers2

2

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.

user2095591
  • 21
  • 1
  • 3
0

Reading the ANT manual, there an followsymlinks attribute that defaults to true. You said those things you want to exclude are symlinks (although i am not sure if this will work with Windows joints). Try adding followsymlinks=false

Another solution: if all your files under scripts_dir have a set number of characters in the extension, you can put that into your include statement. This will only pickup files with extensions of 3 characters:
**/scripts_dir/*.???
More on this here

Slav
  • 27,057
  • 11
  • 80
  • 104
  • Unfortunately, I use only the web interface of Jenkins. So, hacking into the config.xml is not an option. Alternatively, the files in `scripts_dir` have different extension size... – user2095591 Feb 21 '13 at 15:53
  • But they all have an extension? So you can include multiple matches for `**/scripts_dir/*.?, **/scripts_dir/*.??, **/scripts_dir/*.???, **/scripts_dir/*.????`. This will handle upto 4 character extension – Slav Feb 21 '13 at 17:14