Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listAll = function(_path, _files, noredundant, excludeFiles)
- local thisProgram = ""
- if shell then
- thisProgram = shell.getRunningProgram()
- end
- local path = _path or ""
- local files = _files or {}
- if #path > 1 then table.insert(files, path) end
- for _, file in ipairs(fs.list(path)) do
- local path = fs.combine(path, file)
- if (file ~= thisProgram) and (not fs.isReadOnly(file)) then
- local guud = true
- for a = 1, #excludeFiles do
- if excludeFiles[a] == file then
- guud = false
- break
- end
- end
- if guud then
- if fs.isDir(path) then
- listAll(path, files, noredundant, excludeFiles)
- else
- table.insert(files, path)
- end
- end
- end
- end
- if noredundant then
- for a = 1, #files do
- if fs.isDir(tostring(files[a])) then
- if #fs.list(tostring(files[a])) ~= 0 then
- table.remove(files,a)
- end
- end
- end
- end
- return files
- end
- local tArg = {...}
- function getAllSpace(path)
- local freespace = fs.getFreeSpace(path or "")
- local filetree = listAll(path or "",{},false,{})
- for a = 1, #filetree do
- if not fs.isDir(filetree[a]) then
- freespace = freespace + fs.getSize(filetree[a])
- end
- end
- end
- print(getAllSpace(tArg[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement