Advertisement
Blackhome

copy

Jan 6th, 2025
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. toDisk = ...
  2.  
  3. stringtoboolean = { ["true"] = true, ["false"] = false }
  4.  
  5. local bToDisk = false
  6. if toDisk then
  7.     bToDisk = stringtoboolean[toDisk]
  8. end
  9.  
  10. -- Function to load all programs to or from the disk
  11. local function loadAllFromDisk(startPath, destinationPath)
  12.     local files = fs.list(startPath)
  13.     for _, file in ipairs(files) do
  14.         local fullPath = fs.combine(startPath, file)
  15.         local destPath = fs.combine(destinationPath, file)
  16.  
  17.         if not fs.isDir(fullPath) then
  18.             print("Copy " .. file .. " from " .. fullPath .. " to " .. destPath)
  19.             fs.copy(fullPath, destPath)
  20.         end
  21.     end
  22.     print("All files were copied")
  23. end
  24.  
  25. -- Disk-Pfad
  26. local startPath = "disk/"
  27. local destinationPath = "/"
  28.  
  29. if bToDisk then
  30.     startPath = "/"
  31.     destinationPath = "disk/"
  32. end
  33.  
  34. -- Überprüfen, ob das Disk-Laufwerk vorhanden ist
  35. if fs.exists("disk/") then
  36.     loadAllFromDisk(startPath, destinationPath)
  37. else
  38.     print("Keine Disk gefunden. Bitte lege eine Disk ein.")
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement