Button To Suction Files

This might have been answered, but I didn't see any after much searching.

I am looking for a button that will move all files from selected folder into the current folder, rename any duplicates then delete the empty folders.

As an example.
Selecting Adam and using the button:
Downloads\Adam\Brutus\test.txt
Downloads\Adam\Cletus\test.txt
Downloads\Adam\Darwin\test.txt
Downloads\Adam\Darwin\Elroy\test.txt
Downloads\Adam\Darwin\Flower\test.txt

Would become:
Downloads\test.txt
Downloads\test (1).txt
Downloads\test (2).txt
Downloads\test (3).txt
Downloads\test (4).txt

And the empty folders Adam\Brutus, Adam\Cletus, Adam\Darwin, Adam\Darwin\Elroy\ and Adam\Darwin\Flower would be deleted to the recycle bin.

I currently have one that just moves everything, files and folders up one folder and gives me:
Downloads\Brutus\test.txt
Downloads\Cletus\test.txt
Downloads\Darwin\test.txt
Downloads\Darwin\Elroy\test.txt
Downloads\Darwin\Flower\test.txt

@dirsonly
@nofilenamequoting
Copy MOVE FILE "{filepath$}*" HERE
Delete FILTER="emptyfolders"

I am aware of the program "Suction" that you can use to do the same thing, but am looking for a button to do it.

Any help would be appreciated.

Thanks.

Shawn

One of the things mentioned here might be what you need: Quick buttons for directory organisation - #14 by Leo

Thanks, VERY close to what I am looking for, but would definitely work in a pinch. Just a few things to make it exactly what I am looking for.

I would love it to be able to use it without going into the folder that I want suctioned. Be in the Downloads folder with the directory Adam selected and just have all the files in Adam and subfolders moved to the Downloads folder, then have the Adam folder deleted, since there should be no files in it anymore, just empty folders.

Shawn

try this

That's very close to what I am looking for, but one that will also move the files from the selected folder to the current folder, and ideally Adam and all the empty subfolders would be deleted, or left in Adam for easy deletion, or even all the subfolders could be copied over as well. At this stage I am not too picky.

I hope this makes sense, if not let me know, and I'll try to explain it better.

Thanks.

Shawn

?
Move all subfolder files to current folder / Unpack folders - Buttons/Scripts - Directory Opus Resource Centre (dopus.com)

I have taken bits of all the suggestions and came up with:

@dirsonly
Rename PATTERN="*" TO="{filepath|.}*" AUTORENAME RECURSE HERE
Copy MOVE FILE "{filepath|.}*" HERE
Delete 

It moves everything up, folders and files, and deletes the selected folders. Just doesn't delete the subfolders, but not the subfolders. But that is just something that I can live with, that does most of what I was looking for.

Thanks for all the help.

Shawn

Delete * NORECYCLE SKIPNOTEMPTY could be used to remove all empty folders below the current directory.

(Empty as in nothing at all is inside them. If a folder has a sub-folder -- empty or not -- or any files, it will be left.)

Why not use this script?

I am not familiar with scripts. I prefer buttons because they are easy to customize to what I am looking for.

Thanks.

Shawn

I added toolbar button.

1 Like

Leo, putting that in the button code gives me the same results, but I get the following error:

Screenshot - 2023.08.13-16.53.26

...and neither of the selected folders were deleted. Using a simple 'Delete" will leave just the empty subfolders.

The code I was using that deleted the selected folders but left the subfolders was:

@dirsonly
Rename PATTERN="" TO="{filepath|.}" AUTORENAME RECURSE HERE
Copy MOVE FILE "{filepath|.}*" HERE
Delete

Thanks.

Shawn

WKen, that worked great. If I had known you could just put the script in the button code box, it would have saved me a lot of work. I assumed that the script had to be in a special file, I never really looked into using scripts.

Thanks for the help.

Shawn