Posted 16 December 2012 - 05:20 PM
On a server for me and a friend, I thought it'd be nice to have a convenient backup script running in the background of the computer, backing up all the files to a disk every five minutes or so.
I haven't messed with coroutines very much and my logic involving them only reaches the parallel API. Here's my current code:
Any way to make this run in the background every five minutes? (without the "copied blahblah" messages, of course)</side>
I haven't messed with coroutines very much and my logic involving them only reaches the parallel API. Here's my current code:
local args = {...}
if #args < 1 then
print 'Usage: backup <side>'
return
end
local backup = disk.getMountPath(args[1])
for _, path in pairs(fs.list('/')) do
if not path:find('rom')
and not path:find('disk')
and not path:find('backup') then
local newpath = fs.combine(backup, path)
if fs.exists(newpath) then
fs.delete(newpath)
end
fs.copy(path, newpath)
print('Copied '..path)
end
end
Any way to make this run in the background every five minutes? (without the "copied blahblah" messages, of course)</side>