0
2
I'm trying to do what's done in this question, but I want to attach it to a context menu on Directory so I can right-click on "Flatten Folder" and have it do it for me. That is, bring all the individual files within that folder up to the current directory, then delete the empty directory.
How can I flatten out a folder in Windows 7, assuming all file names are different?
I'm not sure what I'm doing wrong? In the registry command key I've got:
cmd /K "for /f %f in ('dir "%1\*" /s/b/a-d') do if not %~ff"=="%1" move "%f" "%1"
&& for /f %f in ('dir "%1\*" /s/b/ad') do if not "%~ff"=="%1" rd /s/q "%f" pause"
EDIT: I have the context menu option, but when I click it I get an error saying that the foldername application is not found.
UPDATED My registry change looks like this: Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Flatten Folder]
@="Flatten Folder"
[HKEY_CLASSES_ROOT\Directory\shell\Flatten Folder\command]
@="cmd /K \"for /f %f in ('dir \"%1\\*\" /s/b/a-d') do if not %~ff\"==\"%1\" move \"%f\" \"%1\""
Still no dice, but no error either.
@ScottChamberlain -See edit. – MAW74656 – 2013-02-15T21:40:26.563