1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| task(function() import "java.io.File" import "android.util.Log" function addNomedia(file) local listFiles=file.listFiles() if listFiles for _,child in ipairs(luajava.astable(listFiles)) if child.isDirectory() Log.i("findPath",child.toString()) addNomedia(child) else if String(child.name).matches(".+\\.(png|jpeg|jpg|webp|gif|mp4|avi|flv|ts)") local addFileStr=file.toString().."/.nomedia" io.open(addFileStr,"w"):write("") Log.i("addPath",addFileStr) end end end end end
addNomedia(File("/sdcard/Download/jiesou.github.io/node_modules/")) print("ok") end)
|