Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Exporer Context Menu: Empty Folder #15762

Closed
Cheese-Echidna opened this issue Jan 25, 2022 · 6 comments
Closed

File Exporer Context Menu: Empty Folder #15762

Cheese-Echidna opened this issue Jan 25, 2022 · 6 comments
Labels
Idea-New PowerToy Suggestion for a PowerToy Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@Cheese-Echidna
Copy link

Description of the new feature / enhancement

It would be an option in the file explorer context menu when you right-click on a folder, it would be called "empty folder to current directory" or similar and there would be a second option called "empty folder to current directory recurcivley". The first option would take all the files out of the folder that is being right-clicked on and move them into the directory being viewed, i.e. into the same directory as the folder that was storing them moments ago. The "recursively" option would continue doing this for every subdirectory until what was left was only files and not folders. Ideally, you would be able to select multiple folders at once and do it to all of them.

Scenario when this would be used?

This would be really helpful, as there is currently no way I know of to speed up this process when you have to go into many folders and empty out their contents.

Supporting information

No response

@Cheese-Echidna Cheese-Echidna added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Jan 25, 2022
@franky920920 franky920920 added the Idea-New PowerToy Suggestion for a PowerToy label Jan 25, 2022
@sredna
Copy link
Contributor

sredna commented Jan 25, 2022

How often do you actually do this?

The first one is just Enter, Ctrl+A, Ctrl+X, Backspace, Ctrl+V. The recursive operation can be manually performed by using any file search tool and just Ctrl+A and then dragging and dropping the files into the desired directory.

You could write a simple PowerShell script or something else that does this. As a suboptimal PoC you can use this .reg file:

REGEDIT4

[HKEY_CURRENT_USER\Software\Classes\Directory\Shell\SillyEmpty\command]
@="cmd /c (for %%A in (\"%1\\*\") do @move /-Y \"%%~fA\" \"%1\\..\\\")&(for /D %%A in (\"%1\\*\") do @move /-Y \"%%~fA\" \"%1\\..\\\")&cd..&rd \"%1\""

[HKEY_CURRENT_USER\Software\Classes\Directory\Shell\SillyRecursiveEmpty\command]
@="cmd /c (for /R \"%1\" %%A in (*) do @move /-Y \"%%~fA\" \"%1\\..\\\")&(for /R \"%1\" %%A in (.) do @rd \"%%~fA\" 2>nul)&cd..&rd \"%1\""

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jan 26, 2022

@sredna I believe it's not really about moving everything one level up, but more to dissolve the folders and place all files in the root folder. That is a duplicate of #9269

Thanks for the reg/cmd code though 🙂

@sredna
Copy link
Contributor

sredna commented Jan 26, 2022

I believe it's not really about moving everything one level up, but more to dissolve the folders and place all files in the root folder.

That 2nd reg code does move all files to the root (by root, I mean the parent of the folder you right-clicked on). It might have some issues deleting some of the leftover empty directories but solving that in one line without any kind of force switch was more than the 5 minutes I was willing to spend on this.

@Cheese-Echidna
Copy link
Author

@sredna I believe it's not really about moving everything one level up, but more to dissolve the folders and place all files in the root folder. That is a duplicate of #9269

Thanks for the reg/cmd code though 🙂

Thanks for finding (and linking) that one, I'm definitely going to use it. I still think a feature like this could be useful as a power toys option.

@franky920920
Copy link
Contributor

Duplicate of #9269

@franky920920 franky920920 marked this as a duplicate of #9269 Jan 27, 2022
@franky920920
Copy link
Contributor

franky920920 commented Jan 27, 2022

Issue is a duplicate

Thank you for your issue! We've linked your report against another issue to centralize the thread.

Thanks for helping us to make PowerToys a better piece of software.

@franky920920 franky920920 added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Jan 27, 2022
@crutkas crutkas closed this as completed Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-New PowerToy Suggestion for a PowerToy Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

5 participants