There are various ways to go about this. Here’s one example:
property doNotDelete : {alias "Macintosh HD:Folder B:", alias "Macintosh HD:Folder C:", alias "Macintosh HD:Folder D:"}
tell application "Finder"
move every item of doNotDelete to desktop -- Moves Folders B, C and D to the Desktop
move every item of alias "Macintosh HD:Folder A:" to trash -- Moves everything else in Folder A to Trash
move every item of doNotDelete to alias "Macintosh HD:Folder A:" -- Moves Folders B, C and D back to their original location (Folder A)
end tell
Note that we used “alias” references to the doNotDelete folders in the previous script! This allows the script to keep track of the folders which are moved. For example, if the first line of the script above had been written like this…
property doNotDelete : {folder “Macintosh HD:Folder B:”, folder “Macintosh HD:Folder C:”, folder “Macintosh HD:Folder D:”}
… Using “alias” allows the script to complete the “move” command because it kept track of where the folders were moved to when they temporarily went to the Desktop.
It’s important to note that any object which an alias refers to must already exist in order for the script to compile.