I have a script that uploads files to a remote server using WinSCP. The files are processed and deleted by the receiver on the remote server. I would like to upload only new files being written to the local server, and once uploaded, change the file extension from .txt to .csv. This way, when the script runs again, it will only upload new files with the .txt extension, ignoring those that have already been uploaded with the .csv extension.
This what I have currently but it won't rename the files on the local server. If I use ren *.txt *.csv it will rename them on the remote server.
lcd C:\Files
cd /directory
put -filemask="*.txt" -latest -nopreservetime *
lcd C:\Files
!ren *.txt *.csv
exit
WinSCP does not allow you to rename local files.
But you can rename them from your batch file, after WinSCP finishes.