Jump to content
Sign in to follow this  
daland

file SOP naming problem

Recommended Posts

Hi all,

I am writing a little script that reads in a bunch of bgeos in file SOPs (and then does some other stuff)... I want the name of the file SOP to be the name of the .bgeo. using s foreach and everything works fine except for

the naming of the file SOP

The problem is that SOPs don't like to have those pesky periods in the name like " file.bgeo"

in UNIX I can strip off the extenion using :r

set name = file.bgeo

set stripname = $name:r

I am looking for a way to do this in the textport...

any ideas?

thanks,

david

Share this post


Link to post
Share on other sites

Hey,

So you wanted the name of your File SOP (i.e. "MyBgeo") to be the name of in the field, right? Would something like: `opname(".")`.bgeo works?

Share this post


Link to post
Share on other sites

actually what I am looking for is a way to name my

file SOP the same as the file it is reading...

so if I am reading in mygeo.bgeo, I want the file SOP to be named mygeo

david

Share this post


Link to post
Share on other sites

set new_fname = `substr($fname, 0, rindex($fname,"."))`

(where the fname variable is set to your full filename)

Share this post


Link to post
Share on other sites

thanks danteA!

your suggestion works except when I use a variable like $fname..

If I use test.bgeo in place of $fname it works...I think it is maybe a

syntax problem ...have tried using quotes, ticks, single quotes but can't

quite get the right combination....

any ideas?

basically this is how I am using it.

-------------------------------------

foreach J ( `system("ls /bgeo")`)

echo $J

set geoname = `substr($j,0,rindex($j,"."))`

echo $geoname

---------------------------------------

thanks,

david

Share this post


Link to post
Share on other sites

variables are case-sensitive in houdini. this means that you either stick to using all uppercase J or all lowercase j.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×