Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
function archive(chto,vochto) local Massiv2 = {} local function FileList(path) local Massiv = fs.list(path) if #Massiv==0 then local Massiv2Id = #Massiv2 + 1 Massiv2[Massiv2Id] = {} Massiv2[Massiv2Id]["path"] = path Massiv2[Massiv2Id]["text"] = "@empty@empty" else for i=1,#Massiv do if fs.isDir(path.."/"..Massiv[i]) and Massiv[i] ~= "/rom" and Massiv[i] ~= "rom" then FileList(path.."/"..Massiv[i]) elseif not fs.isDir(path.."/"..Massiv[i]) and Massiv[i] ~= "/rom" and Massiv[i] ~= "rom" then local Massiv2Id = #Massiv2 + 1 Massiv2[Massiv2Id] = {} Massiv2[Massiv2Id]["path"] = path.."/"..Massiv[i] local file = fs.open(path.."/"..Massiv[i],"r") Massiv2[Massiv2Id]["text"] = file.readAll() file.close() end end end end FileList(chto) file=fs.open(vochto..".zip","w") file.write(textutils.serialise(Massiv2)) file.close() return Massiv2 end function unarchive(chto,kuda) local file = fs.open(chto,"r") Massiv = textutils.unserialise(file.readAll()) file.close() for i=1,#Massiv do if Massiv[i]["text"] == "@empty@empty" then fs.makeDir(kuda.."/"..Massiv[i]["path"]) else local file = fs.open(kuda.."/"..Massiv[i]["path"],"w") file.write(Massiv[i]["text"]) file.close() end end end
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)