Applescript - Get folder name and copy

- Code: Select all
tell application "Finder"
set parentFolder to name of container of (theFile)
display dialog parentFolder as text
set newfolder to "Macintosh HD:Users:david:Dropbox:shares:yx public:Teaching Stuff" & ":" & parentFolder
display dialog newfolder as text
move theFile to newfolder
end tell
I'm super new to applescript, but what I'm trying to do is move theFile to the folder with the same name as it's parent folder. Kinda weird, but it's acting as a sort of 'selective sync'.
Any ideas why this is giving me an error. The variables look like they're popping up right.
Thanks,
- David