Hello Chris,
Here is a piece of code (from Frederic Rinaldi I think) which can get
you started:
Params:
theFolder: path to the root folder you want to scan
addFullPath : boolean to get absolute (true) or relative path (false)
allInfos : boolean to get all information (true) or path only (false)
item 2 & 3 in the returned list with allInfos=true are the file size
(data fork with Mac OS) and the resource fork size (Mac OS only, 0
for others)
function AllFiles theFolder,addFullPath,allInfos
--returns full path of all enclosed files
local startFolder
set cursor to busy
if last char of theFolder is not "/"
then put "/" after theFolder
if startFolder is empty
then put theFolder into startFolder
set the defaultFolder to theFolder
if the result is not empty
then
beep
answer error "Répertoire inexistant:" & return & return &
theFolder titled "Erreur"
exit to top
end if
put the detailed files into filesList
filter filesList without ".*"
filter filesList without "Icon%0D*"
filter filesList without "*,MACSfdrp" -- remove folder aliases
put the folders into foldersList
filter foldersList without ".*"
repeat for each line loopFolder in foldersList
put AllFiles(thefolder & loopFolder & "/",addFullPath,allInfos)
& return after resultList
end repeat
repeat with i=number of lines of filesList down to 1
-- set cursor to busy
if addFullPath
then put MyURLEncode(theFolder) before line i of filesList
if allInfos = false
then put item 1 of line i of filesList into line i of filesList
end repeat
get resultList & filesList
sort lines of it
return word 1 to -1 of it -- strip empty lines
end AllFiles
------------------
function MyURLEncode what
put URLEncode(what) into what
replace "%2F" with "/" in what
return what
end MyURLEncode
Le 13 juil. 05 à 10:15, Chris Carroll-Davis a écrit :
Iit's for both Mac & PC really - but mainly mac at the moment.
Since posting, I've found that I can get the info I need with
applescript - "Tell application "Finder" ... return physical size
of folder "Folderpath" ... End tell", but of course that's no good
for PC. I could look at your suggestion, but I need this to run on
any machine - i.e. I can't rely on any other software being
installed. :-(
Looks like I might have to bite the bullet and do it with
transcript eventually. Yuk. I know for a decent programmer it is
an easy job, but I'm getting old and brain is slow!
Thanks
Chris
Hello folks -
Anyone know if there is an easy way in Rev of getting the size of a
folder (together with all it's sub-folders). I know I can do a loop
using "detailed files" and "detailed folders" but that seems a bit
long-winded, and I'm sure I'd be re-inventing the wheel! Is there
another way, or is there an existing function anywhere that I can
pinch?
Best Regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
Free plugins and tutorials on my website
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email [EMAIL PROTECTED]/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution