Changing names of temporary FolderItems


I am obtaining a temporary folderitem by GetTemporaryFolderitem(). Then I want to append an extension to the folderitem by f.Name = f.Name + ".extension"

However, rather than changing the name, a duplicate with the extension gets created while the folderitem still points to the file without the extension. The weird thing is: It does not always happen but rather randomly. Calling my whole method again might work first and then stop working or the other way around. Bug?

Try this


Are you sure the folderItem exists before renaming it?
I believe the GetTemporaryFolderitem() method returns a file, but still not existing yet.
Also I’m not sure if renaming it’s a safe operation.

Why not this?

dim f as folderItem = SpecialFolder.Temporary.child("myPreferredName.ext")

Worked, thanks both!