how I can open a file inside a folder

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
nahid2011
Posts: 74
Joined: Thu Jun 02, 2011 5:50 am
Location: OPS structures company

how I can open a file inside a folder

Post by nahid2011 »

Dear Sir or Madam
by the following command I can open "envelopeX$i.out", which is saved beside the "main.tcl" in the same directory.

for {set i 1} {$i <= $nodeID} {incr i 1} {
if [catch {open envelopeX$i.out r} InFileID] {
puts "ERROR - cannot open envelopeX.out"
}

I also have a folder beside my program named "results", and I have saved the displacement outputs there named "disp.out"
how I can open a file (disp.out) which is in a folder (results) in the programs directory?

thanks
evxjr
Posts: 20
Joined: Mon Nov 01, 2010 4:13 am
Location: University of Nottingham

Re: how I can open a file inside a folder

Post by evxjr »

To locate a file just specify the path to it. In your case you can use:

[open results/disp.out r]

usual rules for variable substitution exist so if you have a long path name or want to open different folders in a loop and such can use:

[open $path/disp r]
Post Reply