1
0
mirror of https://github.com/akpaevj/executor-scripts.git synced 2025-07-13 06:40:37 +02:00
Files

32 lines
937 B
Plaintext
Raw Permalink Normal View History

2024-03-01 14:14:46 +03:00
#required Path.sbsl
2024-03-04 23:27:09 +03:00
#required Path.sbsl
2024-02-19 23:13:42 +03:00
2024-02-17 23:19:54 +03:00
@Global
2024-03-04 23:27:09 +03:00
method CreateFromDirectory(StartPath: String, ZipPath: String)
val Folder = new File(StartPath)
val Archive = new File(ZipPath)
2024-02-19 23:13:42 +03:00
var Writer = new ZipWriter(Archive.OpenWritableStream())
2024-02-17 23:19:54 +03:00
2024-03-04 23:27:09 +03:00
Folder.Children.ForEach(Child -> AddToZipArchive(Child, Writer))
2024-02-17 23:19:54 +03:00
Writer.Write()
;
2024-03-04 23:27:09 +03:00
@Global
method ExtractToDirectory(ZipPath: String, ExtractPath: String)
val Archive = new ZipFile(ZipPath)
if not Path.Exists(ExtractPath)
Files.CreateDirectory(ExtractPath)
;
Archive.ExtractAll(ExtractPath)
;
2024-03-01 14:14:46 +03:00
method AddToZipArchive(FileToZipping: File, Writer: ZipWriter, RelativePath: String = "")
2024-02-19 23:13:42 +03:00
if FileToZipping.IsFile()
2024-03-01 14:14:46 +03:00
Writer.Add(FileToZipping.OpenReadableStream(), Path.Join(RelativePath, FileToZipping.Name))
2024-02-19 23:13:42 +03:00
else
2024-03-01 14:14:46 +03:00
FileToZipping.Children.ForEach(Child -> AddToZipArchive(Child, Writer, Path.Join(RelativePath, FileToZipping.Name)))
2024-02-17 23:19:54 +03:00
;
;