Open mystery-z opened 2 years ago
@hishamhm Really really sorry for the @ but you seem pretty active here, maybe you could provide a response (if I may humbly ask for this feature).
Thanks!
It can be done in pure Lua I think. That said; if you can contribute a PR, that would be most welcome I think.
@Tieske yes, it can. I have similar pure-Lua code in luarocks.fs.*
using lfs
. Might even move it out of there and into an lfs/util.lua
module here, or something.
@Tieske As far as my research goes, the way to do it in pure lua is to use os.execute
, but the problem with that is that Unix and Windows have different commands, so the OS needs to be checked first and then there can be an if...then...elseif...
statement to switch depending on the OS.
And for files that can be opened using the io.read
can be done by making another file (in the destination directory) and copying over the contents.
Is this something similar to what you mean?
@hishamhm Also could you copy and paste a snippet of your code here? It would really help if I could see how you did this. Thanks!
And for files that can be opened using the io.read can be done by making another file (in the destination directory) and copying over the contents.
Yes, this is what the LuaRocks code does for pure-Lua copying, and os.rename
can be used for moving. Using lfs to create folders, there's no need to os.execute
.
Is there any way to copy/move files using LFS?
I found this from a couple years ago asking for this very feature.
Any updates? And if not what are the reasons this hasn't been implemented yet?