Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


List files in a folder

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Thu Dec 15, 2016 9:15 am    Post subject: List files in a folder Reply with quote

How can I list all the files that are in a folder?
_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Thu Dec 15, 2016 10:04 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Dec 15, 2016 10:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Fri Dec 16, 2016 7:58 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites