feat(*): Add DeleteLocalFile

This commit is contained in:
Josh Creek
2021-08-29 15:49:26 +01:00
parent bc6918ca2d
commit 7f866d3f98
+19
View File
@@ -145,5 +145,24 @@ namespace YouTubeChannelDownloader
Console.WriteLine("SFTP done"); Console.WriteLine("SFTP done");
} }
private static void DeleteLocalFile(string pathString)
{
try
{
// Check if file exists with its full path
if (File.Exists(pathString))
{
// If file found, delete it
File.Delete(pathString);
Console.WriteLine("Local file deleted.");
}
else Console.WriteLine("Local file not found");
}
catch (IOException ioExp)
{
Console.WriteLine(ioExp.Message);
}
}
} }
} }