Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- [Tool/Patch] Hunest
- @version 1.0, 2016-12-28
- @author TheOddByte
- --]]
- local function yield()
- os.queueEvent( "yield" )
- coroutine.yield( "yield" )
- end
- local function fixNesting( sPath )
- local paths = {}
- local name = fs.getName( sPath )
- local path = name
- print( "[*] Scanning nested folders.." )
- while fs.exists( fs.combine( path, name ) ) and fs.isDir( fs.combine( path, name ) ) do
- path = fs.combine( path, name )
- table.insert( paths, path )
- yield()
- end
- print( "[*] Scanning done, found " .. tostring( #paths ) .. " nested folder(s)" )
- print( "[*] Deleting.." )
- for i = #paths, 1, -1 do
- fs.delete( paths[i] )
- yield()
- end
- print( "[*] Done :D" )
- end
- local function main( ... )
- local args = { ... }
- if #args < 1 then
- error( "Usage: hunest <path>", 0 )
- end
- local path = args[1]
- if not fs.exists( path ) then
- error( "Path does not exist", 0 )
- end
- fixNesting( path )
- end
- main( ... )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement