Re: Count files
Re: Count files
- Subject: Re: Count files
- From: Andy Wylie <email@hidden>
- Date: Wed, 14 Aug 2002 22:56:47 +1200
on Tue, 13 Aug 2002 15:59:19 -0400 Marc K. Myers wrote:
>
set chgFldr to (choose folder)
>
tell application "Finder" to set chgFiles to files of chgFldr
>
set fileCnt to count chgFiles
>
set numLng to (count (fileCnt as text)) * -1
>
if numLng > -3 then set numLng to -3
>
repeat with i from 1 to fileCnt
>
set fileName to (text numLng thru -1 of ((10000000 + i) as text)) & ".doc"
>
tell application "Finder" to set name of (item i of chgFiles) to fileName
>
end repeat
I think it's a lot faster to use a simple loop for zero padding...
set _List to {}
repeat with n from 1 to 10
set myNum to n as string
repeat 3 - (count myNum) times
set myNum to "0" & myNum
end repeat
set _List's end to myNum
end repeat
_List
--> {"001", "002", "003", "004", "005", "006", "007", "008", "009",
"010"}
_____________________________ Andy
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.