Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

public void Delete(string fileToDelete, string host, string username, string password)
{
try
{
using (var sftpClient = new SftpClient(host, username, password))
{
sftpClient.Connect();
sftpClient.DeleteFile(fileToDelete);
public void Download(string fileToDownload, string host, string username, string password)
{
try
{
using (var sftpClient = new SftpClient(host, username, password))
using (var fs = new FileStream(Path.GetFileName(fileToDownload), FileMode.OpenOrCreate))
{
sftpClient.Connect();
sftpClient.DownloadFile(
public void Upload(string fileToUpload, string host, string username, string password)
{
try
{
using (var sftpClient = new SftpClient(host, username, password))
using (var fs = new FileStream(fileToUpload, FileMode.Open))
{
sftpClient.Connect();
sftpClient.UploadFile(
public void ListDirectory(string remoteDirectory, string host, string username, string password)
{
try
{
using (var sftpClient = new SftpClient(host, username, password))
{
sftpClient.Connect();
var files = sftpClient.ListDirectory(remoteDirectory);
@jorgepsmatos
jorgepsmatos / SMWinservice.py
Created November 27, 2018 22:14
Python Http Server as Windows Service
'''
SMWinservice
by Davide Mastromatteo
from https://medium.com/the-python-corner/how-to-create-a-windows-service-in-python-88ca534ce76b
Base class to create winservice in Python
-----------------------------------------
Instructions:
@jorgepsmatos
jorgepsmatos / cloudSettings
Last active March 13, 2021 22:05
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-03-13T22:05:37.704Z","extensionVersion":"v3.4.3"}