daland Posted November 4, 2002 Share Posted November 4, 2002 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 Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted November 4, 2002 Share Posted November 4, 2002 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? Quote Link to comment Share on other sites More sharing options...
daland Posted November 4, 2002 Author Share Posted November 4, 2002 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 Quote Link to comment Share on other sites More sharing options...
danteA Posted November 4, 2002 Share Posted November 4, 2002 set new_fname = `substr($fname, 0, rindex($fname,"."))` (where the fname variable is set to your full filename) Quote Link to comment Share on other sites More sharing options...
daland Posted November 6, 2002 Author Share Posted November 6, 2002 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 Quote Link to comment Share on other sites More sharing options...
danteA Posted November 6, 2002 Share Posted November 6, 2002 variables are case-sensitive in houdini. this means that you either stick to using all uppercase J or all lowercase j. Quote Link to comment Share on other sites More sharing options...
daland Posted November 6, 2002 Author Share Posted November 6, 2002 DOG-GONE-IT! Thank you....sometimes it just takes another set of fresh eye!! much appreciated! david Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.