Natizyskunk / vscode-sftp

Super fast sftp/ftp extension for VS Code
Other
393 stars 75 forks source link

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

Open leVirve opened 1 year ago

leVirve commented 1 year ago

Is this a similar or duplicate feature request?

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?

Natizyskunk commented 11 months ago

@leVirve Seems really neat. You can absolutely open a pull request, I even encourage you to do so ^^