Atomicos 2 Posted October 16, 2019 Share Posted October 16, 2019 Is possible to copy files in openos with percent progress output? Require for big files copy with low speed over network card. Probably im first who ask this Quote Link to post Share on other sites
1 CptMercury 6 Posted October 16, 2019 Share Posted October 16, 2019 You want a progress bar for the file transfer via modems? There is no built-in method available, so you need custom scripts for this. My approach would start with calculating the file's size and transmitting it to the receiving computer. Then the file is split into packets and transferred; by the size of the arriving packets the progress can easily be calculated. The remaining question is how to split the file. You could either send line by line or send a fixed number of bytes. Depending on your choice, the calculation method for the file size will vary. Number of lines: local n = 0 -- number of your lines for _ in io.lines("path/to/file") do n = n + 1 end Number of bytes: -- Method 1: local function filesize (file) local pos = file:seek() local size = file:seek("end") file:seek("set", pos) return size end -- open file and call function with file local f = assert(io.open("path/to/file")) local n = filesize(f) -- Method 2: local f = assert(io.open("path/to/file")) local data = f:read("*all") local size = #data The only thing you then need is a way to display the progress, either by simply printing the percentage or by drawing a more or less detailed progress bar. I hope in correctly interpreted your question and this gets you started. Feel free to ask if you need further assistance. Quote Link to post Share on other sites
Is possible to copy files in openos with percent progress output? Require for big files copy with low speed over network card.
Probably im first who ask this
Link to post
Share on other sites