1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00
CC-Tweaked/src/main/resources/assets/computercraft/lua/rom/programs/rename.lua
2019-06-13 08:00:06 +01:00

22 lines
477 B
Lua

local tArgs = { ... }
if #tArgs < 2 then
print( "Usage: rename <source> <destination>" )
return
end
local sSource = shell.resolve( tArgs[1] )
local sDest = shell.resolve( tArgs[2] )
if not fs.exists( sSource ) then
printError( "No matching files" )
return
elseif fs.exists( sDest ) then
printError( "Destination exists" )
return
elseif fs.isReadOnly( sDest ) then
printError( "Destination is read-only" )
return
end
fs.move( sSource, sDest )