Which folderitem properties

Hi everyone
I read a text… make some changes… then write another text file with REV at the end
Which properties from my input folderitem do i have to get
To have same path, same name (+REV) before the extension
when it come time to create my output folder item (mac & pc)
thanks

Hi Denis,

You can use the NativePath property.

Try this:

[code]
dim f as FolderItem = GetOpenFolderItem("")

	dim fullpath as String = f.NativePath
	
	fullpath = fullpath.NthField(".",1) + "Rev"
	
	dim fo as  new FolderItem(fullpath, FolderItem.PathTypeNative)
	
	dim txto as TextOutputStream
	
	txto = TextOutputStream.Append(fo)
	txto.WriteLine("This is a test")
	txto.Close[/code]

Javier

I would use FolderItem.Name to add the REV suffix. Messing around with full paths for file names is just silly.
You can pass a folder item to the constructor to duplicate it.

My general rule of thumb is if you can stay away from the path, take that route.

Thanks both of you
But i’v return to the point where i was before posting here
( i was struggling with folderitem parent…then get and set the name + Rev ) Anyway it didn’t work
The new file overwrite the original input file WITH a new Name
fullpath = inFolderItems.NativePath outFolderItems = new FolderItem(fullpath, FolderItem.PathTypeNative) outFolderItems.Name = outFolderItems.Name.NthField(".",1) + "Rev.txt"

Try to create the new FolderItem using the NEW name (as in my example code), that way you don’t overwrite the old one.

Javier

I just tried to use both of your solution together
But yes your solution works ( As is )
Thanks Javier

This method will fail if the file name has “.” (excluding the one for the extension) and you have to reinsert the extension.

better:
dim f as FolderItem = GetOpenFolderItem("")
dim v() as string=f.name.split(".")
if v.Ubound=0 then
v(0)=v(0)+“REV”
else
v(v.Ubound-1)=v(v.Ubound-1)+“REV”
end if
f=f.parent.child(join(v, “.”))

Yes Antonio i’v noticed that
So i take your solution
Thanks