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)

Hi Denis,

You can use the NativePath property.

Try this:

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")


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.


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.

dim f as FolderItem = GetOpenFolderItem("")
dim v() as string=f.name.split(".")
if v.Ubound=0 then
end if
f=f.parent.child(join(v, “.”))

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