Posted 14 September 2013 - 11:08 AM
I am having a weird issue, I am getting an access denied error on line 47 of the following http://pastebin.com/240tXAJA
Spoiler
--[[
Name: masscopy
Description: Allows you to copy all of the files in one directory to another
Author: Kreezxil
Date: 9/14/2013
]]--
args = { ... }
if #args == 0 then
print("Usage: ")
print(" masscopy <source> <destination>")
print("")
print(" where <source> and <destination> are both directories.")
end
if args[1] ~= nil then
source = shell.resolve(args[1])
if not fs.isDir(source) then
print("Error! Invalid source directory specified. Try again.")
return
end
end
if args[2] ~= nil then
dest = shell.resolve(args[2])
if not fs.isDir(dest) then
print("Creating destination directory " .. dest)
fs.makeDir(dest)
end
end
list = fs.list(source)
for _,file in ipairs(list) do
exists=false
if fs.exists(dest .. "/" .. file) then
exists=true
print("File " .. file .. " exists at destination! Overwrite? (y/n)")
ans = read()
if string.find("Yy",ans) ~= nil then
exists=false
fs.delete(dest .. "/" .. file)
end
end
if not exists then
fs.copy("/" .. source .. "/" .. file,dest) -- line 47
print("Copying file " .. file .. " to " .. dest)
else
print("Not Copying file " .. file .. " to " .. dest .. " per your instructions.")
end
end
print("Done Copying!")