JScript that unfolders a folder similar to unzipping a zip file

Is it possible? Can anybody help me create this script? I don't know where to start.

No need for scripting. This will do it, if the aim is to move everything in the selected folder up to the current folder:

Copy MOVE {filepath$}* TO {filepath$|..} QUEUE=none
Delete FILE={filepath$} NORECYCLE SKIPNOTEMPTY QUIET

That also works with Flat View, and will avoid incorrectly deleting nested folders with the same name as the folder being removed.