I have also this one to use subfolders :
[code]
utils.copyFileInFolder = function(fichier, cheminSource, destination, sousDossier, overwrite)
–print(tostring(fichier)…" “…tostring(cheminSource)…” “…tostring(destination)…” "…tostring(sousDossier))
lfs = require “lfs”
local results = true
local source_path = system.pathForFile(fichier, cheminSource)
local readFile = io.open(source_path, “rb”)
local data = readFile:read("*a")
local dest_path = system.pathForFile("", destination)
local success = lfs.chdir(dest_path)
local dest_folder = lfs.currentdir()…"/"…sousDossier…"/"
–print("DESTINATION : "…tostring(dest_folder))
local success = lfs.chdir(dest_folder)
local myFile = io.open( dest_folder…"/"…fichier, “w+b” )
myFile:write(data)
readFile:close()
myFile:close()
lfs.chdir(dest_path)
return "succes : “…tostring(fichier)…” copié vers "…tostring(dest_folder)
end
[/code] [import]uid: 5578 topic_id: 30966 reply_id: 124191[/import]