If I were to write this macro, here's how I would do it:
1. Precondition: the folder to move after the origin is selected
2. Use ISelectionMgr::GetSelectedObject6 to get IFeature, then IFeature::GetSpecificFeature2 to get IFeatureFolder, then Get the pointers of all of the features in the original folder using IFeatureFolder::GetFeatures.
3. Delete the selected folder using IModelDoc2::EditDelete
4. Use Artem's code, which Deepak linked to above, to create a new folder after the origin. This macro takes advantage of the fact that you can rollback an assembly using the API --- something you actually can't do manually.
5. Get the pointer to this new folder using IModelDocExtension::GetLastFeatureAdded
6. Use IAssemblyDoc::ReorderComponents to move the features to the new folder. Shouldn't be hard, since you should have the pointers for these features (step 2) and new the folder (step 5).
Note that IAssemblyDoc::ReorderComponents only works with components at the top level or within a single assembly. You cannot move components from one sub-assembly to another, from the top level to a sub-assembly, or from the sub-assembly to the top level, it appears.