User Tools

Site Tools


guides:patterns:winscp

Using WinSCP to Edit Files on Windows and Compile on Linux

Overview

  1. The user connects to the remote machine via WinSCP.
  2. Using an editor on a windows system, the user changes files, which are automatically transferred to a remote machine.
  3. Using an terminal open on the remote machine (PuTTY), the user compiles and executes the code.

Discussion

WinSCP is a file transfer client for windows. It has a nice graphical user interface and is a good choice for transferring files between windows and linux.

This client can be configured to provide a simple yet powerful graphics environment when editing on windows and compiling on a remote linux machine.

WinSCP has the option of using a built-editor or an editor that has been installed on the windows computer. It has notepad configured for this option by default. Unfortunately neither of these are particularly well suited for coding. It is relatively easy to configure WinSCP to use any editor installed on the windows computer.

A minor change needs to be made to WinSCP to prevent this software from changing the timestamp on the remote machine, thus confusing the make system.

Configuration Steps

Configuring an Alternative Editor for WinSCP

In order to perform this procedure, you should have an alternative text editor installed on your windows computer. This example will show how to configure WinSCP to use Notepad++. The example assumes that Notepad++ is already installed.

  1. Connect to the remote machine with WinSCP.
  2. Right click on any text file and select *Edit* → *Configure …*
  3. Select the *Add* option to add a new editor.
  4. Select *External Editor:* and browse to your editor of choice.
    1. If you are unsure of the location of your editor you can:
    2. Right click on the editor icon on the desktop and select *Preferences *
    3. Note the path to the executable in the *Target* box
    4. Be sure to browse to the path as WinSCP adds other values at the end of the path.
  5. Click *OK* and finish
  6. If you want this become the default editor, use the *Up* button to move the new entry to the top of the list.

Disabling Timestamp Preservation in WinSCP

At the time of writing the default configuration for WinSCP attempts to preserve the time stamp for files transferred. This behavior will cause a problem for tools such as make as it will set the timestamp for the file incorrectly.

Note that the time for the file main.cpp is only the date, not the date and time. Also notice that make flags this as an error.

To correct this problem:

  1. In the WinSCP application
    1. Select the Dropdown menu for *Transfer Settings*/
    2. Select *Default* and click on *Edit*
    3. Disable *Preserve timestamp* in the *Common Options* area
    4. Click *OK* to close each window.

Note the time is now included for the file main.cpp and make no longer reports an error.

Resources

guides/patterns/winscp.txt · Last modified: 2022/08/02 11:59 by 127.0.0.1