Rename Files on the Fly While Transferring with WinSCP

When uploading files to a website, it's easy to let WinSCP do its thing. The file name will likely be the same as the one online when fixing typos and updating content. However, what happens if the file names don't match? We'll need to upload the new file, remove the old one, and rename the new file so that it works with the website's links. The process is tedious; especially if the process is repeated dozens of times. Luckily, WinSCP provides a better way.


Every so often, I like to experiment with new solutions. Sometimes these solutions won't see the light of day. They may get lost in the shuffle, for example, as higher-priority projects come along. For this reason, I prefer to create a copy of the page being experimented on. The new file is usually named to provide clues about the purpose for the update.

For example, if we're adding a related resources section to a page named "reports.php", the duplicate might be called "reports (new resources section).php". The additional text is useful, but the constant process of uploading the new file, deleting the old one, and renaming the new one is cumbersome. So, let's see how WinSCP can streamline the process.

Alternate Solution

Instead of going through the hassle of uploading, deleting, and renaming every time there's an update to test, WinSCP allows us to rename files on the fly. When uploading files, the dialog box shown in Figure 1 appears.

WinSCP screenshot showing the default copy dialog box
Figure 1. Copy File As Is

The dialog displays where the file is being uploaded, along with a few characters at the end which didn't make much sense until now. The "*.*" at the end is the key. The asterisks are wild cards telling WinSCP upload the file as is. Modifying the first asterisk, however, let's us rename the file. So changing "*.*" to "reports.*" (see Figure 2), uploads the file as "reports.php".

WinSCP screenshot showing how to rename the file on the fly
Figure 2. Copy File with New Name

Upon clicking Copy, a confirmation box should pop up asking if the reports.php file on the server should be overwritten.

WinSCP screenshot showing the overwrite confirmation box
Figure 3. Overwrite Confirmation Box


Although renaming the file every time is still a little tedious, it's not as bad as uploading, deleting, and renaming. With enough practice, I'm hoping the new process will become second nature.


There are currently no comments.

Leave a Comment