Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

 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. 

0 votes

Comments

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
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


0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,023

Question asked: Jan 07 '14, 12:32 p.m.

Question was seen: 4,390 times

Last updated: Jan 13 '14, 5:05 p.m.

Confirmation Cancel Confirm