I am trying to count the number of files in a selected folder and place it in a text box. I am a newbie so I do apologize if this is something very basic. I have searched the documentation and couldn't find any help for this.
Thanks for any help!
Warren
Counting Files In A folder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
hi warrenk,
try this, it should get you startedregards
bernd
try this, it should get you started
Code: Select all
on mouseUp pMouseBtnNo
answer folder "please choose folder to get the files of"
if it is empty then exit mouseUp
put it into tFolderToSearch
put the defaultfolder into tOldDefaultFolder -- to restore it later
set the defaultfolder to tFolderToSearch
put the files into tAllFiles -- gives you all the files of the folder
-- you may want to filter the files for the type you want; look up filter with or filter without
--filter tAllFiles without ".*" -- on a mac there are invisible files that start with a dot
--filter tAllFiles with "*.rev" -- to just get rev stacks
--filter tAllFiles with "*.pdf" -- to just get pdfs
set the defaultfolder to tOldDefaultFolder -- restore the default folder, not necessary but nice
put 0 into tSoMany -- just in case there are none
put the number of lines of tAllFiles into tSoMany
put "there are " & tSoMany & " files" & return & "these are the files: " & return & tAllFiles
end mouseUp
bernd