Sink highlighted items into new folder?

Hello!

Is it possible to get a function where I can highlight multiple directories/files and then hit a menu option to move them all into a new folder in the folder they're currently in that I choose the name of?

example:

Highlight files, right click, choose "Sink into folder named...", dialog pops up asking for name of folder, enter folder name, folder is created, files get moved into it?

That's just a rudimentary overview of the idea; if there's a better way to do it (make folder, move files, rename folder, etc) that's fine too. Just trying to be able to sink multiple selections into a new folder.

Sure! Try this:

Copy MOVE HERE CREATEFOLDER="{dlgstring|Enter name of new folder}"

And here is the button if it's more convenient (just enter Customize mode and drag & drop the downloaded file onto your Opus toolbar):
Move into new Folder.dcf (383 Bytes)

1 Like

Awesome, that seems to work pretty well, thank you!

The only issue I've got is that if there is already a folder named the same as one of the selections it throws an error that it can't move a folder into itself.

Hm I had this idea, it might work, try this expanded variant:

@set foldername="{dlgstring|Enter name of new folder}"
Select DESELECT {$foldername}
Copy MOVE HERE CREATEFOLDER={$foldername}

Updated version of this button for download:
Move into new Folder.dcf (503 Bytes)

This variant simply deselects the target folder (if it exists) before moving everything else into it (just like before). This should do the trick.

What if the folder that it deselects to move things into has things in it already, though?
I think the process probably needs to be

Get name
Create dummy folder with safe temporary name
Move things into dummy folder
Rename safe temporary named folder to name given

Does that make sense? I'm trying to logic this out myself, haha. :slight_smile:

Thanks for all of your help for sure.

Try this. It doesn't care if a folder name already exists.

@nofilenamequoting
@set dir={dlgstringS|Enter name of folder to move selection into|{file|noterm|noext}}
Copy MOVE TO="{sourcepath$}" CREATEFOLDER="{$dir}"

This was posted by Leo

1 Like

When I try that I get the "you can't copy or move a folder into itself" error.

Oh yeah, I never ran into that kind of scenario (only tested with files). I'll let Leo try and help then.

That makes sense, if you need to handle the situation where the target folder name already exists and needs to be moved inside of itself.

Is there a built-in Opus function to check for name existence, or would the best way be to just say name={time}temp{time}, createfolder=name, move everything then rename name into {dialogresult}?

I'm sure the odds of there being an existing folder named after 2 timestamps with temp in the middle is probably lottery winning level stuff, but I'd prefer to do things in the most legit & safe way possible so if anybody else needs it it will be safe for them too, haha.

:slight_smile:

You can do that using a fairly simple script, yes.