View previous topic :: View next topic |
Author |
Message |
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Thu Dec 15, 2016 9:15 am Post subject: List files in a folder |
|
|
How can I list all the files that are in a folder?
_________________
... |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Dec 15, 2016 10:04 am Post subject: |
|
|
Code: |
getFileList(Path:string, searchMask:string OPTIONAL, SearchSubDirs: boolean OPTIONAL, DirAttrib: integer OPTIONAL): Returns an indexed table with filenames
getDirectoryList(Path:string, SearchSubDirs: boolean OPTIONAL): Returns an indexed table with directory names
|
e.g:
Code: |
return getFileList(getCheatEngineDir())
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Dec 15, 2016 10:44 pm Post subject: |
|
|
Code: | return getFileList(getCheatEngineDir()) |
attempt to call a nil value (global 'getFileList'), when tested using CE 6.4 / CE 6.5.1
If mean to listing files in a folder, here is code :
Code: | for dir in io.popen([[dir "C:\Program Files\" /b /ad]]):lines() do print(dir) end |
Code: | local f = io.popen("dir \"C:\\users\\\"")
if f then
print(f:read("*a"))
else
print("failed to read")
end |
First code to get (example) all files in C:\Program Files
and second code to get info about Directory given
|
|
Back to top |
|
|
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Fri Dec 16, 2016 7:58 am Post subject: |
|
|
I was able to do what I wanted. I changed "/ ad" to "/ a" and it worked as I wanted.
Code: |
for i in io.popen([[dir "C:\log\language\" /b /a]]):lines() do print(i) end |
_________________
... |
|
Back to top |
|
|
|