Moving a user chosen folder to a destination that may or may not exist

I have been cracking my head trying to do this for the days, reading post after post and manual after manual. Anybody up for some insight? The furthest i’m able to get is

choose folder
tell application “Finder”

and i’ve tried different things as if folder “folder” exists then move else create, but the problem i keep running into is how to call the alias that’s the result of the choose folder and also how to take care of this if the destination is a folder tree, for example:

Library > Application Support > Test > Test1 >

Test and Test1 will most likely not be there and need to be created, and i’d like them to be created only if they don’t exist as i will be writing other scripts that call the same folders and odn’t want any overwriting to go on. I’m not looking for someone to write the script for me but maybe just a heads up as to the commands i need to use so i can stop banging my head against a wall. Thanks in advance!

This should give you an idea =)

set deskPath to path to desktop as Unicode text
set destinationFolder to deskPath & "Test"
tell application "Finder"
	set userFolder to choose folder
	if exists folder destinationFolder then
	else
		make new folder at deskPath with properties {name:"Test"}
	end if
	move userFolder to destinationFolder
end tell

Or you can use shell scripts:

set deskPath to POSIX path of (path to desktop folder)
set selectFolder to quoted form of POSIX path of (choose folder)
set originalFolder to deskPath & "Original"
set destinationFolder to deskPath & "Backup"
try
	do shell script "mv " & originalFolder & space & destinationFolder
on error
	do shell script "mv " & selectFolder & space & originalFolder
end try

hey guys, thanks for the responses, i got it working! You guys were awesome.

LOL, that’s usually my line :smiley:

Just edited my entry to allow a choose folder as requested.

Actually made a small mistake, this one is better:

set deskPath to POSIX path of (path to desktop folder)
set selectFolder to quoted form of POSIX path of (choose folder)
set originalFolder to deskPath & "Original"
set destinationFolder to deskPath & "Backup"
try
	do shell script "mv " & originalFolder & space & destinationFolder
end try
do shell script "mv " & selectFolder & space & originalFolder