mirror of
https://github.com/jcreek/YouTubeChannelDownloader.git
synced 2026-07-13 03:03:46 +00:00
feat(*): Add TransferFileToNasShare
This commit is contained in:
@@ -121,5 +121,29 @@ namespace YouTubeChannelDownloader
|
|||||||
|
|
||||||
return pathString;
|
return pathString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void TransferFileToNasShare(string pathString)
|
||||||
|
{
|
||||||
|
SftpConfig sftpConfig = new SftpConfig()
|
||||||
|
{
|
||||||
|
Host = Environment.GetEnvironmentVariable("SFTP_HOST", EnvironmentVariableTarget.Process),
|
||||||
|
Port = int.Parse(Environment.GetEnvironmentVariable("SFTP_PORT", EnvironmentVariableTarget.Process)),
|
||||||
|
UserName = Environment.GetEnvironmentVariable("SFTP_USER", EnvironmentVariableTarget.Process),
|
||||||
|
Password = Environment.GetEnvironmentVariable("SFTP_PASSWORD", EnvironmentVariableTarget.Process),
|
||||||
|
};
|
||||||
|
|
||||||
|
Console.WriteLine($"Path: {pathString}");
|
||||||
|
|
||||||
|
string origFileName = RemoveSlashesFromString(pathString);
|
||||||
|
string fileName = MakeValidFileName(origFileName);
|
||||||
|
|
||||||
|
Console.WriteLine($"Filename: {fileName}");
|
||||||
|
|
||||||
|
SftpService sftpService = new SftpService(null, sftpConfig);
|
||||||
|
string destinationFolder = Environment.GetEnvironmentVariable("SFTP_DESTINATIONFOLDER", EnvironmentVariableTarget.Process);
|
||||||
|
sftpService.UploadFile(pathString, destinationFolder, fileName);
|
||||||
|
|
||||||
|
Console.WriteLine("SFTP done");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user