Detect files?
Moderators: Shine, Insert_witty_name
-
- Posts: 35
- Joined: Mon Aug 22, 2005 7:48 am
Detect files?
Is there a way to find out how many files are in a folder and save it to a variable?
Not very clean or efficient, but short:
If you don't want to count subfolders as files you'll have to do a bit more work ;)
Code: Select all
function System.numFiles(dir)
-- - 2 to not count . and .. (remove if you want to count them)
return table.getn(System.listDirectory(dir)) - 2
end
-
- Posts: 35
- Joined: Mon Aug 22, 2005 7:48 am
files = System.numFiles("/dir/dir/") , where "dir" is a directory, isnt working
Last edited by soulphalanx on Fri Nov 11, 2005 10:28 am, edited 1 time in total.
-
- Posts: 11
- Joined: Mon Oct 10, 2005 8:45 am