What am I missing? Creating Folder tree and moving files to it

Ok, I’m trying to make a script that creates a Folder, a Sub Folder in that new folder, then copies files to the newly created Sub Folder. Here’s what I have:

tell application "Finder"
	set main_folder to (make new folder at "Lexi:Users:tom:Documents:Clients:" with properties {name:clientName}) as alias
	set fileDestination to (make new folder at main_folder with properties {name:projectName & " (" & projectDate & ")"})
	move every file of folder "Lexi:Users:tom:Desktop:New Client" to folder fileDestination
end tell

The clientName, projectName and projectDate variables are all based on dialogs earlier in the script. Currently it creates the folder structure fine, but it won’t copy anything into it.

Also, how do I make it skip the creation of the clientName folder if its already present, but still go on and make a projectName subFolder if its different?

For example, if Acme is already my client with a project of Roadrunner Bomb. And I get a new project from them of Roadrunner Hammer, how do I let the script not error out, but only create the new Roadrunner Hammer folder and move the files to it?

Model: MacBook Pro 2.33GHz
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi,

fileDestination is already a folder specifier, so omit “folder”.
For creating multiple folders and check their existence I use a subroutine

set main_folder to make_new_folder(((path to documents folder as Unicode text) & "Clients:"), clientName)
set fileDestination to make_new_folder(main_folder, projectName & " (" & projectDate & ")")
tell application "Finder" to move every file of folder "New Client" to fileDestination -- the "root" folder of the Finder is the Desktop of the current user

on make_new_folder(theFolder, fName)
	try
		return ((theFolder as Unicode text) & fName) as alias
	on error
		tell application "Finder" to return (make new folder at theFolder with properties {name:fName}) as alias
	end try
end make_new_folder

So is “path to documents folder as Unicode text” an instruction to me, or is that what needs to be typed into the script?

path to documents folder is just a direct path to the documents folder of the current user, which makes the script portable

So then

make_new_folder(((path to documents folder as Unicode text) & "Clients:"), clientName)

would then create a folder located:

Macintosh HD\Users\tom\Documents\Clients<ClientName>

Right? Do the other folders in the Users directory work the same way as well? (ie, Music, Pictures, Movies, etc)

Right!
Here the list of path to options from standard additions
apple menu The Apple Menu Items folder
application support The Application Support folder
applications folder The user’s Applications folder
control panels The Control Panels folder
control strip modules The Control Strip Modules folder
desktop The user’s Desktop folder
desktop pictures folder The Desktop Pictures folder
documents folder The user’s Documents folder
extensions The Extensions folder
favorites folder The user’s Favorites folder
Folder Action scripts The user’s Folder Action Scripts folder
fonts The Fonts folder
frontmost application
help The Help folder
home folder The user’s home folder
internet plugins The Internet Plug-Ins folder
keychain folder The user’s Keychains folder
launcher items folder The Launcher Items folder
library folder The Library folder
modem scripts The Modem Scripts folder
movies folder The user’s Movies folder
music folder The user’s Music folder
pictures folder The user’s Pictures folder
preferences The user’s Preferences folder
printer descriptions The Printer Descriptions folder
printer drivers The Printer Drivers folder
printmonitor The PrintMonitor Documents folder
public folder The user’s Public folder
scripting additions The Scripting Additions folder
scripts folder The user’s Scripts folder
shared documents The shared Documents folder
shared libraries The CFMSupport folder
shutdown folder The Shutdown Items folder
sites folder The user’s Sites folder
speakable items The Speakable Items folder
startup disk The startup disk
startup items The StartupItems folder
stationery The Stationery folder
system folder The System folder
system preferences The PreferencePanes folder
temporary items The Temporary Items folder
trash The user’s Trash folder
users folder The Users folder
utilities folder The Utilities folder
voices The Voices folder
workflows folder The Workflows folder