It's all about the answers!

Ask a question

how do you determine if a directory has content within a Build Forge step?


Daniel martin (10122926) | asked Jan 07 '14, 12:32 p.m.
 I need to setup a conditional step based on the contents of a folder. I haven't found away to do that yet. Any guidance would be great. 

Comments
Robert haig commented Jan 13 '14, 5:05 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

use .bset with backticks

http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m3/index.jsp?topic=%2Fcom.ibm.rational.buildforge.doc%2Ftopics%2Fdotcmd_bset.html has an example using a shell script at the bottom, but you can just use shell commands.

.bset env DIRCONTENTS=ls
or
.bset env  SEMFILE=ls semaphore

then use the created env var in your next step that is your conditional

One answer



permanent link
Kevin Ramer (4.5k9186201) | answered Jan 10 '14, 4:41 p.m.
edited Jan 10 '14, 4:42 p.m.
Do you mean _any_ kind of content i.e. 1 or more files

On unix one could do: 
dir=/some/path/to/examine

nfiles=$(find $dir -type f | wc -l)
if [ $nfiles -ne 0 ]; then
   there be content here
fi

On dos based build  "dir /s" might best the way to approach


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.