SHOW:
|
|
- or go back to the newest paste.
1 | --DiskCopy by PeachMaster | |
2 | --There are comments for you BigJ :) | |
3 | ||
4 | term.clear() | |
5 | term.setCursorPos(1,1) | |
6 | print("DiskCopy by PeachMaster.") | |
7 | print("Left is input, right is output.") | |
8 | print("Press ENTER to start the operation.") | |
9 | read() | |
10 | ||
11 | local count = 1 | |
12 | ||
13 | while true do | |
14 | sleep(5) | |
15 | ||
16 | if disk.isPresent("left") then -- Checks if a disk is present on the left disk drive. | |
17 | else -- It's not. Kay, error it.. | |
18 | error("A disk is not in the left drive. Please check it.") | |
19 | end | |
20 | ||
21 | if disk.isPresent("right") then -- Checks again.. | |
22 | else -- It's not. Kay, error it.. | |
23 | error("A disk is not in the right drive. Please check it.") | |
24 | end | |
25 | ||
26 | print("Starting disk copy.") | |
27 | ||
28 | --Get every file and directory on the left disk. | |
29 | local FileList = fs.list(disk.getMountPath("left")) | |
30 | - | for f, file in pairs(FileList) do |
30 | + | |
31 | - | --Alright, for each one, we will copy it to the right disk. |
31 | + | for i=1,FileList do |
32 | - | fs.copy(file, disk.getMountPath("right") |
32 | + | fs.copy(table[i], disk.getMountPath("right")) |
33 | end | |
34 | - | end) |
34 | + | |
35 | disk.setLabel("right", disk.getLabel("left")) | |
36 | ||
37 | --Disk copy completed! | |
38 | count = count + 1 | |
39 | print(count.." copy created.") | |
40 | ||
41 | end |