Archivator
unknown
csharp
a year ago
534 B
5
Indexable
using System.IO.Compression; Random random = new Random(); Console.WriteLine("Enter file path"); string filePath = Console.ReadLine(); string zipRootPath = "C:\\dotnet\\"; if (File.Exists(filePath)) { using (ZipArchive zipArchive = ZipFile.Open(zipRootPath + $"{random.Next(1000):d4}.zip", ZipArchiveMode.Create)) { zipArchive.CreateEntryFromFile(filePath, Path.GetFileName(filePath)); } Console.WriteLine("successfully archived"); } else { Console.WriteLine("Can't find file"); }
Editor is loading...
Leave a Comment