vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

Proposal: File deletion option for overwriting on ProFTPD Server with "mod_rename" module

Open leVirve opened this issue 10 months ago • 1 comments

Is this a similar or duplicate feature request?

  • [ ] I don't know. I will go check it.
  • [x] No.

Is your feature request related to a problem? Please describe.

I encounter an ongoing challenge while working with FTP configured using the ProFTPD module mod_rename.

Within this configuration, the process of overwriting files is cumbersome. For instance, when attempting to overwrite a file such as file.txt that already resides on the server, the file undergoes a renaming process that appends prefixes or suffixes, resulting in names like file.txt.1, file.txt.2, and so on.

Describe the solution you'd like

I propose to introduce an option to delete the target file first before proceeding upload.

To navigate around this limitation, I have explored an effective workaround presented in the commit https://github.com/leVirve/sftp-replay/commit/938f1bfcd087884c7c801806044bcb6283eccebb. This solution has proven successful in my specific use case. I am inclined to contribute to this enhancement by initiating a pull request.

    let stat: FileStats | undefined;
    try {
      stat = await this.lstat(path);
    } catch (error) {
      logger.info(error);
    }
    if (stat) {
      if (stat.type === FileType.File) this.atomicDeleteFile(path);
    }

Does this project help you?

  • [x] Yes. SFTP IS AWESOME!

leVirve avatar Aug 31 '23 13:08 leVirve