Rename on sFTP site

I have a command that adds or removes underscore at the end of a file name.
Unfortunately the code doesn't work on sFTP sites. Any ideas how to make it work?

(I need it is when I want to temporarily rename a file to something else -- eg. when swapping two files names -- or disable some functionality in an application.)

Rename TO {file$}_ Rename REGEXP PATTERN (.*)__$ TO \1

Try this instead, which does it with a single rename:

Rename PATTERN * TO * @script vbscript Option Explicit Function Rename_GetNewName ( strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName ) If (Right(strNewName,1) = "_") Then strNewName = Left(strNewName,Len(strNewName)-1) Else strNewName = strNewName & "_" End If End Function

Works as intended, thanks!