Specify if it's a file or folder on updating FM

folder on new folder
set $fileOrFolder on pasting, that is used then on updating
file on uploading
file on saving
Use new fileOrFolder param to determin type

Rather than rely on a . in the name