I'm looking for a command that will move the contents of a selected folder to the current folder. Similar to how 'Extract Here...' works for archives, but for folders, and also removing the contents from the source folder.
I thought I had found the solution with the "ContentsToCurrentFolder" command from this thread, but can't get it working for some reason.
The code I'm trying to use:
@dirsonly @nofilenamequoting Copy MOVE FILE "{filepath$}\*" HERE Delete QUIET NORECYCLE
(On earlier versions, before SKIPNOTEMPTY existed, using the DOS rmdir command was another way. See Quick buttons for directory organisation for an example, although the example there moves the current dir up a level, rather than selected dirs.)
Only deleting the folder if it is empty is important in the case where the folder has another folder with the same name inside itself. (That can happen quite frequently after extracting an archive.)
e.g. If you have a folder Cat like this:
Cat\
Cat\
Meow.txt
If you select that first Cat folder and click the button, everything will be moved up a level, leaving you with this:
Cat\
Meow.txt
Now, if you delete the selected folder, which is still Cat, you'll be left with nothing at all and Meow.txt will be lost.
Adding SKIPNOTEMPTY means the folder will not be deleted if it still has anything in it. (Note that SKIPNOTEMPTY only works in conjunction with NORECYCLE. That was already on the command but would need adding in cases that don't already have it.)