Move Contents of Selected Folder(s) to Current Folder

Assuming Opus 12, I would add SKIPNOTEMPTY to the Delete command:

@dirsonly
@nofilenamequoting
Copy MOVE FILE "{filepath$}\*" HERE
Delete QUIET NORECYCLE SKIPNOTEMPTY

(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.)

3 Likes