Move to parent and delete folder

I made button for move selected files to parent folder and delete the folder from which the files were copied.

Copy MOVE {filepath$} TO {filepath$|..\..}
Delete {s} FORCE QUIET FAILNOTEMPTY

(first command I found somewhere on this forum)

Is any way to go to parent folder after that operation a little faster, without wait that Opus back to parent itself (after detecting that folder do not exists anymore)?

Go UP will probably work, unless it goes wrong if it has already noticed the folder is gone.

If that doesn't work, Go {sourcepath|..} should work, I think.

Note that the way you're doing the move & delete isn't safe if you move a folder up that has the same name as the current folder. Not usually a problem but something to keep in mind.

Is any safer method that always work?

If you're moving everything up a level then a simple solution is to check if the folder is empty. (The delete command has a special argument for exactly this situation.)

If you're only moving selected files up and intending to delete anything that is left, it would probably require some script logic, so to check if any of the things being moved has the same name as the parent folder. Or perhaps an easier way would be for the script to delete everything that isn't selected, then move everything that is selected up a level, then delete the parent folder if it is now empty.

In fact I never move folders, just files, so it's safe enough I think.

I liked the idea of having a button to move selected files to the parent folder, and I decided it would be better to delete the empty folders manually. So I added a new menu (named "Up Level") to one of my existing menu buttons, and I entered this command:

Copy MOVE {filepath$} TO {filepath$|....}

Then I selected a file and clicked on that menu, but it didn't move the file. Instead I got this error message:
"An error occurred moving 'filename.ext': Source and destination must be different to move files."

BTW, under Function: I could choose one of these:
1.) Standard Function (Opus or external)
2.) MS-DOS batch function
3.) Script function

Since I didn't know which of these to choose, I tried all three (using the same copy command above). However the error message given was the same all 3 times.

Do you know what I'm doing wrong?

~Paul

A nice example, why this is important :slight_smile:

I've fixed the first post. It was from before the forum software change so it probably looked correct back when it was posted.

I also added FAILNOTEMPTY to the command to make it safer. That may not have existed back then either.

1 Like

I'm not sure why you are saying I meant to post something different. I wouldn't have posted what you suggested because if I had tried that command it would have worked and there would have been no need to post anything. Perhaps it would have been simpler to just say I was missing a backslash character. I guess Leo is saying the backslash didn't appear in the post I was following because of changes to the forum software. I did think four dots in a row looked somewhat strange, but I just assumed it had some meaning that I was unaware of :slight_smile:

Anyway, my "Up Level" button now works as I had hoped. Thanks all for your help!

~Paul