Since the default io library seems to be enabled this should work: http://stackoverflow.com/questions/16367524/copy-csv-file-to-new-file-in-lua As the top answer mentions though this is not advisable for large files as it loads the whole thing into your RAM.
I found this link too. os.execute() doesn't work (returns 0) this method doesn't work with large files
if you're trying to accomplish this with lua from a UI app, consider using torquescript. this is an example from my racetimer addon that reads the name.cs of a vehicle, copying a file shouldn't be very different: Code: callLuaFuncCallback("v.vehicleDirectory", function(result) { var getVehicleNameCode = "function readVehicleName(%path) { %fileReader = new FileObject(); %fileReader.openForRead(%path); %name = %fileReader.readLine(); %fileReader.close(); return %name; }"; // the torque code to read the file executeGameEngineCode(getVehicleNameCode); // insert the torque function into the engine callGameEngineFuncCallback("readVehicleName(\""+result+"name.cs\")", function(result) { // call the torque function we just stored var car_name = result.substring(result.indexOf('"')+1,result.lastIndexOf('"')); and the torque fileobject documentation: http://luisantonrebollo.github.io/Torque-3D-Wiki-Test/Torque3D script reference/classFileObject.html sorry if this doesn't help.
it would be very smart to consider working around whatever problem you're trying to solve with file operations. i have a feeling that file operations will be disallowed soon... at least, they should be. right now you can do some pretty nasty things from within a mod.
Is this just the night where for once I agree with you. Never happens and then suddenly 3 occurrences in one night. File I/O if allowed at all should be sandboxed heavily. Right now it seems to have raw access across my PC file system, not good at all.
If I need to copy the file, then solve this problem other than copying the file, impossible (backups etc). All mods are open source, so will be hard to hide "some pretty nasty things".
well without knowing more about how your mod works or why you need to read/write files at all, i can't really begin to think of an alternative. it's just something to consider. if someone goes on a successful virus-spreading spree, things will probably start to change.
the lua is already sandboxed, but in non-enforcing mode. Do not expect this to continue to work in the future.
All good mate, I for one appreciate the hard work you and the team are doing on this, a very humungous cheers But please do not work too hard that you fizzle out for your personal lives.