Question

I'm transferring a small text file over FTP and trying to change the file extension after the transfer's been completed so the destination server can process the contents, how do I do this, the commands on winscp.net aren't particularly helpful but then again, I may be searching like an idiot.

Was it helpful?

Solution

rename oldname newname

If your client complains, try:

quote site rename oldname newname

OTHER TIPS

This is old, but many FTP sessions won't allow you to change the file AFTER the transfer, as you have no permissions to do anything but dump the files into the FTP directory. Why can't they be changed prior to transfer?

If you want to rename file manually after transfer use Rename command:
https://winscp.net/eng/docs/task_rename

You can also configure WinSCP to transfer all files to temporary name and automatically rename them to final name after transfer finishes:
https://winscp.net/eng/docs/ui_pref_resume

In Python I got this code:

import ftplib

ftp_connect = ftplib.FTP(str_host)
ftp_connect.rename(str_oldName, str_newName)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top