115 posts
Location
Maidstone, UK
Posted 04 October 2014 - 09:00 PM
Hello,
Is there a way to move multiple files at once?
For instance, I have tried using fs.move() with a table of files, but it doesn't work.
Can anyone help me out?
Thanks,
- Sam
44 posts
Posted 04 October 2014 - 10:12 PM
You really need to move more than one at once, cant it be done one by one in loop?
Parallel.waitForAll can help you. But bear in mind that probably it will be slower than doing it in loop.
1080 posts
Location
In the Matrix
Posted 04 October 2014 - 10:13 PM
If you're trying to move specific files to other specific spots you can save that in a table and then use a for loop to move.
local filesToMove = {file1 = "Newfile1", file2 = "Newfile2"} --# Etc.
for current,new in pairs(filesToMove) do
fs.move(current,new)
end
It won't do it "at the same time" (and CC can't do it at the same time anyways :P/>) However it should do it relatively quickly.
Edited on 04 October 2014 - 08:14 PM
44 posts
Posted 05 October 2014 - 10:44 AM
He probably could create a table with filename and desired location and then in something loop-like open a bunch of parallels, maybe recursive functions, but thats overkill. Its like creating strategic-class weapon to kill a small fly.
51 posts
Posted 06 October 2014 - 10:54 PM
Computers cannot move multiple files at the same time anyway, because memory is like a line of 0s and 1s where you can only change one 0/1 at a time. You can however use smart tricks to move multiple files faster (like doing one byte at a time or something, would need to check whats the fastest) I would just move the files one by one with fs.move, because fs.move is quite fast and fs.readAll + fs.write quite slow
5 posts
Posted 10 October 2014 - 08:40 PM
and what about a loop?