Re: slow folder action script
Re: slow folder action script
- Subject: Re: slow folder action script
- From: Yvan KOENIG <email@hidden>
- Date: Mon, 9 May 2005 08:35:32 +0200
Le 9 mai 2005 , à 1:56, kai a écrit :
…
Moving hundreds of files will inevitably take some time, Yvan -
although you can speed up the process by moving them in batches,
rather than individually. Try something like this (sorry about the
mishmash of languages):
-------------------
property monDossier : "Mes dossiers"
property debutNom : "mes MP3s #"
property limite : 100
to getDossier at dropFolder
tell application "Finder" to try
dropFolder's folder monDossier
on error
make new folder at dropFolder with properties {name:monDossier}
end try
end getDossier
to makeNewFolder at dossier from currFolder
set n to 1 + (currFolder's (text -3 thru -1))
tell application "Finder" to repeat
try
set newName to debutNom & ((1000 + n) as string)'s text -3 thru -1
dossier's folder newName
set n to n + 1
on error
make new folder at dossier with properties {name:newName}
return {newName, limite}
end try
end repeat
end makeNewFolder
to getCurrFolder at dossier
tell application "Finder" to tell (debutNom & ((1000 + ¬
(count dossier's folders)) as string)'s text -3 thru -1) to try
tell dossier's folder it to set fileLimit to limite - (count files)
if fileLimit is 0 then error
{it, fileLimit}
on error
my (makeNewFolder at dossier from it)
end try
end getCurrFolder
on adding folder items to this_folder after receiving added_items
set dossier to getDossier at this_folder
tell application "Finder"
set {currFolder, fileLimit} to my (getCurrFolder at dossier)
repeat
if (count added_items) > fileLimit then
move items 1 thru fileLimit of added_items to dossier's folder
currFolder
set added_items to items (fileLimit + 1) thru -1 of added_items
set {currFolder, fileLimit} to my (makeNewFolder at dossier from
currFolder)
else
move added_items to dossier's folder currFolder
exit repeat
end if
end repeat
end tell
end adding folder items to
-------------------
---
kai
Thanks Kai
It's exactly what I understood some times after having posted my
question.
I wrote quite the same code but I will study yours in detail.
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden