Hello,
I’m trying to check if a specific file exists in this path: “/ storage / emulated / 0 / Download /”. Does anyone know how I can make this work?
local nome = "/storage/emulated/0/Download/" .. "OC VISUAL " .. os.date("%Y%m%d") .. " H" .. composer.getVariable("ResultadoHORA") .. " M" .. composer.getVariable("ResultadoMINUTO") .. ".CSV" function fileExists(fileName, base) assert(fileName, "fileName is missing") local base = base or system.ResourceDirectory local filePath = system.pathForFile( fileName, base ) local exists = false if (filePath) then local fileHandle = io.open( filePath, "r" ) if (fileHandle) then exists = true io.close(fileHandle) end end return(exists) end function Verify(event) if fileExists(nome) then contadorArquivo = contadorArquivo + 1 nome = nome .. " (" .. contadorArquivo .. ")" .. ".csv" VerificarArquivo() print("excist") else ssk.files.util.writeFile( saida, nome) -- TABLET print("not found") end end Verify()
I think it is this way: https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/files/
but I am not able to develop this code =(