parent
cfc1bb4e79
commit
dc6c24e669
|
@ -16,7 +16,7 @@ Create new file.
|
|||
#### `rm [path]`
|
||||
Remove file.
|
||||
|
||||
#### `cp [old path] [copy path]`
|
||||
#### `cp [original path] [copy path]`
|
||||
Make a copy of a file.
|
||||
|
||||
#### `mkdir [path]`
|
||||
|
@ -25,5 +25,8 @@ Create new directory.
|
|||
#### `rmdir [path]`
|
||||
Remove directory.
|
||||
|
||||
#### `cpdir [old path] [copy path]`
|
||||
Make a copy of a directory.
|
||||
#### `cpdir [original path] [copy path]`
|
||||
Make a copy of a directory.
|
||||
|
||||
#### `mv [old path] [new path]`
|
||||
Move a file or directory to a new location.
|
|
@ -0,0 +1,4 @@
|
|||
name = mv
|
||||
description = Move a file or directory
|
||||
params = [old path] [new path]
|
||||
exec = os/exec/mv.lua
|
|
@ -0,0 +1,21 @@
|
|||
local path = ...
|
||||
local old = path[1]
|
||||
local new = path[2]
|
||||
|
||||
if old and new then
|
||||
if fs.exists(old) then
|
||||
if not fs.exists(new) then
|
||||
if fs.cpdir(old, new) and fs.rmdir(old) then
|
||||
print("Moved "..old.." to "..new)
|
||||
else
|
||||
print(old.." is a file")
|
||||
end
|
||||
else
|
||||
print(new.." already exists")
|
||||
end
|
||||
else
|
||||
print(old.." does not exist")
|
||||
end
|
||||
else
|
||||
print("Must specify old and new path (see help mv)")
|
||||
end
|
Loading…
Reference in New Issue