regex - Remove last directory when copying files in Ant script -
how can copy files directory 1 level up?
i've looked @ cutdirsmapper strips leading directories whereas want strip last directory. example in manual, source filename foo/bar/a.txt should copied foo/a.txt.
this have far:
<copy todir="../vendor"> <fileset dir="${resources}" includes="bootstrap/2.2.1/" /> <fileset dir="${resources}" includes="fontawesome/4.2.0/" /> <fileset dir="${resources}" includes="jquery/2.1.1/" /> </copy> i end folders such ../vendor/bootstrap/2.2.1/ containing third-party libraries i'm looking copy contents of ${resources}/bootstrap/2.2.1/ ../vendor/bootstrap/.
i have tried using regexpmapper this:
<regexpmapper from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\3" handledirsep="true" /> this not work due subfolders inside bootstrap/2.2.1/ (for example css, js, img, etc.)
after further investigation, regexpmapper seemed job:
<regexpmapper from="^([^\/]+)/[^\/]+/(.*)$$" to="\1/\2" handledirsep="true" />
Comments
Post a Comment