View difference between Paste ID: M8wmudwV and zpU6GupX
SHOW: | | - or go back to the newest paste.
1-
local filesystem = require("filesystem")
1+
local filesystem = require("filesystem")
2-
local term = require("term")
2+
local term = require("term")
3-
local shell = require("shell")
3+
local shell = require("shell")
4-
local list = nil
4+
local list = nil
5-
local ins = nil
5+
local ins = nil
6-
local out = nil
6+
local out = nil
7-
local choise = nil
7+
local choise = nil
8-
local dl = nil
8+
local dl = nil
9-
local drives = {}
9+
local drives = {}
10-
local c1 = nil
10+
local c1 = nil
11-
local c2 = nil
11+
local c2 = nil
12-
12+
13-
function termClear()
13+
function termClear()
14-
  term.clear()
14+
  term.clear()
15-
  term.setCursor(1,1)
15+
  term.setCursor(1,1)
16-
end
16+
end
17-
17+
18-
function fold()
18+
function fold()
19-
  termClear()
19+
  termClear()
20-
  print("Enter the location of the folder you want to transfer")
20+
  print("Enter the location of the folder you want to transfer")
21-
  ins = io.read()
21+
  ins = io.read()
22-
  print("Enter the location of the folder you want to extract")
22+
  print("Enter the location of the folder you want to extract")
23-
  out = io.read()
23+
  out = io.read()
24-
  loop()
24+
  loop()
25-
end
25+
end
26-
26+
27-
function loop()
27+
function loop()
28-
  list = filesystem.list(ins)
28+
  list = filesystem.list(ins)
29-
  termClear()
29+
  termClear()
30-
  while true do
30+
  while true do
31-
    s = list()
31+
    s = list()
32-
    if s==nil then
32+
    if s==nil then
33-
      break
33+
      break
34-
    end
34+
    end
35-
  shell.execute("copy -r "..ins.."/"..s.." "..out)
35+
  shell.execute("copy -r "..ins.."/"..s.." "..out)
36-
  print(s.." done!")
36+
  print(s.." done!")
37-
  end
37+
  end
38-
  print("Transfer complete!")
38+
  print("Transfer complete!")
39-
end
39+
end
40-
40+
41-
function driv()
41+
function driv()
42-
  dl = filesystem.list("//mnt")
42+
  dl = filesystem.list("//mnt")
43-
  k = 0
43+
  k = 0
44-
  while true do
44+
  while true do
45-
  s = dl()
45+
  s = dl()
46-
  if s == nil then
46+
  if s == nil then
47-
    break
47+
    break
48-
  end
48+
  end
49-
  k = k + 1
49+
  k = k + 1
50-
  drives[k] = s
50+
  drives[k] = s
51-
  end
51+
  end
52-
  termClear()
52+
  termClear()
53-
  for key, amount in pairs(drives) do
53+
  for key, amount in pairs(drives) do
54-
    print(key..". "..amount)
54+
    print(key..". "..amount)
55-
  end
55+
  end
56-
  term.write("from: ")
56+
  term.write("from: ")
57-
  c1 = io.read()
57+
  c1 = io.read()
58-
  term.write("to: ")
58+
  term.write("to: ")
59-
  c2 = io.read()
59+
  c2 = io.read()
60-
  ins = "//mnt/"..drives[tonumber(c1)]
60+
  ins = "//mnt/"..drives[tonumber(c1)]
61-
  out = "//mnt/"..drives[tonumber(c2)]
61+
  out = "//mnt/"..drives[tonumber(c2)]
62-
  loop()
62+
  loop()
63-
end
63+
end
64-
64+
65-
function start()
65+
function start()
66-
  termClear()
66+
  termClear()
67-
  print("1. drives")
67+
  print("1. drives")
68-
  print("2. folders")
68+
  print("2. folders")
69-
  term.write("choise: ")
69+
  term.write("choise: ")
70-
  choise = io.read()
70+
  choise = io.read()
71-
  choise = tonumber(choise)
71+
  choise = tonumber(choise)
72-
  if choise == 1 then
72+
  if choise == 1 then
73-
    driv()
73+
    driv()
74-
  elseif choise == 2 then
74+
  elseif choise == 2 then
75-
    fold()
75+
    fold()
76-
  end
76+
  end
77-
end
77+
end
78-
78+
79-
79+
80-
80+
81
start()