I need some folder moving exemple

Hi,
the thing is that I’ve got some folder’s path in a list and want to move each folder of that list to a single folder. I’ve looked but didnt’ find something like it, just some exemples of files moving like ‘move every file of folder…’

Here’s what I’ve got:

tell application "Finder"
		activate
		repeat with afolder in folderlist as list
			move folder afolder to folder destFolder
		end repeat
	end tell

destFolder is something like : “Max:toto:”
folderlist is a list of path like ‘destFolder’

at the ‘move’ line, I always got an error…

do I have to change the type of something?

thanks for any suggestion.

Max.

At first glance your script should work. Can you be more specific about the error message you get? That often provides a pointer.

Also, you have verified that the various folders in the list exist, right?

Sorry for the lack of information, I thought it was some syntax error or something…

the folders do exist, since the file is moved to it (see bellow).

The script is used as a folder action and when files are dropped, create a folder for each files named with the date, hour and “.n”, something like “Max:toto:20040520135522.n:” and drop the files in the newly created folder.

so I have something like:

make new folder at this_folder with properties {name:folder_name}
							set destFolder to (this_folder & folder_name) as string
							set folderList to (folderList & destFolder & ":") as list

I guess that may be the problem… since I had some problem finding exemple of adding an item to a list…

Anyway, when, a little lower, I try to move all folders that are in “folderList” I 've got an error, something like (i’m translating from french):

impossible to design “class cfol” (item 1 of {“Max:toto:20040520135522.n”,“Max:toto:20040520135525.n”}) of application “Finder” as a string

error -1700

if I do a

display dialog folderList as string

, it’s displaying a dialog with all path of the created folders.

any idea what’s i’m doing wrong?

Thanks

Max.

Anyway, I changed the folderList to a list of name of folder:

make new folder at this_folder with properties {name:folder_name}
set destFolder to (this_folder & folder_name) as string
set folderList to folder_name as list

and changed a bit the moving folder thing for something like this:

tell application "Finder" 
      activate
      if exists folder destFolder then
            repeat with afolder in folderlist as list 
                  set theFolder to (this_folder & afolder) as string
                  move folder theFolder to folder destFolder 
            end repeat 
      end if
end tell 

and now it work.

Max.

I mean:

set folderList to (folderList  & folder_name) as list

Max.