(1 vote, average 5.00 out of 5)

if you need your output file named exactly like your input file then use a little TCL expression in the file knob of the write node

suggestion your filename convention is like: //path/to/file/filename.pattern.ext

then:

1
[lindex [split [lindex [split [knob [topnode].file] .] 0] /] end]

 

will give you back just the "filename" part of the original read node

if you want to write to same folder as the original file but with a new filename extension you could use:

1
[file dirname [knob [topnode].file]]/[lindex [split [lindex [split [knob [topnode].file] .] 0] /] end]_conv.%04d.exr
Comments (6)

Diogo Girondi said:

...
You could also just use

Root dir:
[file dirname [knob [topnode].file]]

File name:
[file tail [knob [topnode].file]]

File extension:
[file extension [knob [topnode].file]]
August 30, 2010

michael vorberg said:

...
thank you for comments, i totally forgot that there are other file operations than dirname
August 31, 2010

demOOn k said:

...
if [knob [topnode].file] already contain tcl script - better use [value instead [knob
November 27, 2010

Leonardo Yabiku Terukina said:

...
but..., what happens if you have the read node merged with a constant (in B, or A, whathever...). It gives me:
Nothing is named ''node##nn#####.file''.
Any suggenstions?

Thank you!
December 29, 2010

Leonardo Yabiku Terukina said:

...
Excuse me, what happens if I have the read node merged with a constant (constant in B)?
December 30, 2010

a guest said:

...
if you have merge operation - script try to take source filename from B node (in your case is not file with name) so that is why an error
i noticed that issue and flip sources (shift+x)

but here i have an suggestion:
- could anyone correct this recipe to take filename not from previous Read node but from first one (Read1)

PS - how to make this script write with SAME filename but in new folder which was manually created in folder where is Read1 node file is
March 03, 2011

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy