|
#1
|
||||
|
||||
|
-- This funciton will allow for the counting of all files in a directory (aka. folder)
function f_FileCount(dir) tblFiles = File.Find(dir, "*.*", true, false, nil, nil) if tblFiles ~= nil then for i,v in tblFiles do count = i end -- This is just one way to display the results Dialog.Message("Directory file count...", "There are "..count.." files in that directory") else Dialog.Message("Directory file count...", "There are 0 files in that directory") end end -- Example on how to use this function (also known as a "function call") f_FileCount("AutoPlay\\Docs") |
|
#2
|
|||
|
|||
|
Large folder
If the folder has waay to many files....the response of the function will be slow...
My snippets folder...has around 13.300 files it took ~10 seconds to produce the result
|
|
#3
|
||||
|
||||
|
nice function, right about the time on large dir, i just added a status dialog to it so it dosent give the hanging effect
eg: Code:
StatusDlg.Show(MB_ICONNONE, false);
-- Example on how to use this function (also known as a "function call")
f_FileCount("C:\\")
StatusDlg.Hide();
|
|
#4
|
||||
|
||||
|
Another version with a Cancel button this time:
Code:
-- This funciton will allow for the counting of all files in a directory (aka. folder)
function f_FileCount(dir)
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowCancelButton(true, "Cancel")
tblFiles = File.Find(dir, "*.*", true, false, nil, nil)
if tblFiles ~= nil then
for i,v in tblFiles do
blnIsCancelled = StatusDlg.IsCancelled()
if blnIsCancelled ~= true then
count = i
else
blnQuit = true
break
end
end
StatusDlg.Hide()
if blnQuit ~= true then
-- This is just one way to display the results
Dialog.Message("Directory file count...", "There are "..count.." files in that directory")
end
blnQuit = false
end
end
-- Example on how to use this function (also known as a "function call")
f_FileCount("C:\\")
|
|
#5
|
||||
|
||||
|
Another version with "Table.count" instead of a loop
function f_FileCount(dir) local count=0; tblFiles = File.Find(dir, "*.*", true, false, nil, nil) if tblFiles ~= nil then count = Table.count(tblFiles); end; return count; end; usage: number_of_files=f_FileCount("C:\") Stefan_M
__________________
"With a rubber duck, one's never alone." Douglas Adams, The Hitchhiker's Guide to the Galaxy |
|
#6
|
|||
|
|||
|
Hi
Just made this one today. it's a file list counter put the whole path into the Directory Tab and pressing Commence or Enter will do. http://mfiles.naver.net/69bb5f8992c3...6-terratan.exe Last edited by latell; 11-29-2006 at 02:17 AM. |
|
#7
|
|||
|
|||
|
excuse me
can the files be arranged with filename ,or by CreationDate,or by WriteDate? can some body give some ideas or example |
|
#8
|
||||
|
||||
|
You can use File.GetAttributes and .CreationDateISO in loop then remove "-" from result of date and sync. each file with other.
|
|
#9
|
||||
|
||||
|
Quote:
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| http://yourfilelink.com - 50MB max upload, free! | Intrigued | General Chat | 14 | 09-26-2006 09:44 AM |
| help with ftp connect | CAI | AutoPlay Media Studio 6.0 | 0 | 09-29-2005 08:13 PM |
| HOWTO: Create a Project Template | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-28-2002 02:49 PM |
| Can search allow manual browse even if file is found? | RichardShaw | Setup Factory 5.0 | 2 | 08-28-2000 07:08 PM |
| Install only into one of several directories with specific existing file? | RichardShaw | Setup Factory 5.0 | 0 | 08-17-2000 03:29 PM |
All times are GMT -6. The time now is 08:28 AM.









Linear Mode

