Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function get_dir_conts(directory, ign_dirs)
- local contents = {}
- local cmd = "ls " .. directory
- local handle = io.popen(cmd)
- for file in handle:lines() do
- if ign_dirs and ign_dirs[file] then goto continue end
- table.insert(contents, directory .. "/" .. file)
- ::continue::
- end
- handle:close()
- return contents
- end
- local ign_dirs = {}
- ign_dirs["341"] = true
- ign_dirs["421"] = true
- ign_dirs["1ff"] = true
- local src_dir = "/mnt/341/"
- local tgt_dirs = get_dir_conts("/mnt", ign_dirs)
- for _, tgt_dir in ipairs(tgt_dirs) do
- print("clone " .. src_dir .. " to " .. tgt_dir)
- os.execute("cp -v -r " .. src_dir .. "/* " .. tgt_dir)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement