示例#1
0
        public string ComprimirImagenesYPonerZipEnCarpetaDeBackups()
        {
            Directory.CreateDirectory(Paths.BackupAbsolute());
            var backupPath = Paths.BackupImagenes();

            try
            {
                using (var zip = new ZipFile())
                {
                    zip.AddDirectory(Paths.ImagenesAbsolute);
                    Log.Info($"Se comprimió correctamente la carpeta '{Paths.ImagenesAbsolute}'.");
                    zip.Save(backupPath);
                    Log.Info($"Se guardó la carpeta comprimida en '{backupPath}'.");
                }
            }
            catch (Exception ex)
            {
                YKNExHandler.LoguearYLanzarExcepcion(ex, "Error comprimiendo imágenes");
            }

            return(backupPath);
        }