Would it be possible to run this from a context menu?

Rizaria

New member
Local time
8:20 AM
Messages
8
I use the following a lot:

Code:
I prefer (especially with images) to have them all in one folder that I can browse. If you do, too, then open up a command prompt by going to Start --> Run... and typing cmd and ENTER. Then, go to the folder that contains the folders you want to merge. If the folders were in C:\Documents and Settings, you would type cd\"Documents and Settings" to get to it. Then type the following. Be sure to include the dot at the end:


Code:
for /r %i in (*.*) do move "%i" .

The command above moves all files stored in all sub-folders folders of the current folder into the current folder. You can also move files of just one type. For .psd files, for example, you would replace the *.* with *.psd. The /r stands for "recurse," meaning it goes through not just the current folder, but sub-folders, as well. The %i is a variable. Finally, the dot at the end is shorthand for the current folder.

And I was wondering if it'd be possible to make it into a context menu thing, how I could right click on a folder and it would automatically take note of the folder/subfolders/files and run that command?

Or something quite like it. I believe I used to have something on Mac that did it actually..The Big Mean Folder Machine.

Long story short, I want the ability to right click on a folder and merge everything within seamlessly. Can anyone point me in the right direction please?
 

My Computer My Computer

At a glance

Windows 7 Home PremiumIntel i76 GBATi Mobility Radeon HD 5870
Computer Manufacturer/Model Number
ASUS G73
OS
Windows 7 Home Premium
CPU
Intel i7
Memory
6 GB
Graphics Card(s)
ATi Mobility Radeon HD 5870
Sound Card
Realtek HD
Screen Resolution
1600x900
Hard Drives
2x 500GB HDD
Mouse
Logitech MX1100
Internet Speed
ADSL2+
I was intrigued by the idea...and tried to come up with a right-click menu entry to do this. So far, this is what I've got:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\merge]
@="Merge this folder with subfolders"

[HKEY_CLASSES_ROOT\Directory\shell\merge\command]
@="cmd.exe /s /c pushd \"%V\" && for /r %i in (*.*) do move /-y \"%i\" ."
Basically, you would copy/paste this into Notepad, save it with a .reg file extension and doubleclick that file to add the entries to your registry.
After that, you'll get a new context menu entry named Merge this folder with subfolders whenever you rightclick a folder in Explorer.

However: the actual command may not work correctly. DO NOT use this in its current form - I tweaked it a few times and was testing it, until I rightclicked a test folder on my storage drive and upon selecting this command, it started moving files in C:\Windows\system32 around. Needless to say, my heart stopped - thank God it only made a minor mess and I could trace all the files and move them back to where they belong.

I expanded the command line to first make the rightclicked folder its active working directory and then execute the for/move command. I'd just rather not test it again after the near-accident I had, but someone with more shell scripting experience than me can hopefully figure out my mistake.

Anyway, it's something to work with.

 

My Computer My Computer

At a glance

Windows 7 Professional SP1 32-bitIntel Core 2 Duo E6600 2.4GHz4GB DDR2-667 (4x1GB in dual-channel config)nVidia GeForce 9800 GT
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom-built
OS
Windows 7 Professional SP1 32-bit
CPU
Intel Core 2 Duo E6600 2.4GHz
Motherboard
Asus PL5D2
Memory
4GB DDR2-667 (4x1GB in dual-channel config)
Graphics Card(s)
nVidia GeForce 9800 GT
Sound Card
Creative X-Fi XtremeMusic
Monitor(s) Displays
Acer P236H
Screen Resolution
1920x1200 (DVI)
Hard Drives
OCZ SSD Vertex Plus 60GB SATA (Firmware 3.55), 64MB cache
Hitachi HD321KJ SATA, 320GB, 7200rpm, 16MB cache
PSU
Antec TruePower 2.0
Case
Cooler Master Centurion
Cooling
Too many fans
Keyboard
Standard
Mouse
Microsoft wireless optical mouse
Internet Speed
AT&T U-verse (18mbit/sec)
Antivirus
Microsoft Security Essentials
Browser
Firefox
Other Info
Other devices:
Compaq CQ-60 laptop
Google Nexus 7 (2012) tablet
Nvidia SHIELD tablet (US/LTE)
Hardkernel ODROID-XU single-board computer (Samsung Exynos 5420)
I was intrigued by the idea...and tried to come up with a right-click menu entry to do this. So far, this is what I've got:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\merge]
@="Merge this folder with subfolders"

[HKEY_CLASSES_ROOT\Directory\shell\merge\command]
@="cmd.exe /s /c pushd \"%V\" && for /r %i in (*.*) do move /-y \"%i\" ."
Basically, you would copy/paste this into Notepad, save it with a .reg file extension and doubleclick that file to add the entries to your registry.
After that, you'll get a new context menu entry named Merge this folder with subfolders whenever you rightclick a folder in Explorer.

However: the actual command may not work correctly. DO NOT use this in its current form - I tweaked it a few times and was testing it, until I rightclicked a test folder on my storage drive and upon selecting this command, it started moving files in C:\Windows\system32 around. Needless to say, my heart stopped - thank God it only made a minor mess and I could trace all the files and move them back to where they belong.

I expanded the command line to first make the rightclicked folder its active working directory and then execute the for/move command. I'd just rather not test it again after the near-accident I had, but someone with more shell scripting experience than me can hopefully figure out my mistake.

Anyway, it's something to work with.



Interesting but yeah...I'll wait for something that won't screw with my System32 files. :p Windows dies easy enough without that sort of intervention.
 

My Computer My Computer

At a glance

Windows 7 Home PremiumIntel i76 GBATi Mobility Radeon HD 5870
Computer Manufacturer/Model Number
ASUS G73
OS
Windows 7 Home Premium
CPU
Intel i7
Memory
6 GB
Graphics Card(s)
ATi Mobility Radeon HD 5870
Sound Card
Realtek HD
Screen Resolution
1600x900
Hard Drives
2x 500GB HDD
Mouse
Logitech MX1100
Internet Speed
ADSL2+
Couldn't you put that code in a batch file and then create a "context menu" entry (in the "Registry") that points at the batch file?

I'm a bit snowed under at the moment, so I can't give you the specifics. :(
The "big brains" should be able to tell you how to do this off of the top of their heads.
XP used to have a built in tool for manipulating the "context menu".

Remember to backup up your OS, BEFORE you start messing with the Registry. :geek:
 

My Computer My Computer

At a glance

W7 Ultimate SP1, LM19.2 MATE, W10 Home 1703, ...AMD Phenom II x6 1100T, 3.3 GHz12GB DDR3 1333 G-Skill (4GB x 2), G-Skill (2G...NVIDIA GeForce GTX 660
Computer type
PC/Desktop
Computer Manufacturer/Model Number
n/a
OS
W7 Ultimate SP1, LM19.2 MATE, W10 Home 1703, W10 Pro 1703 VM, #All 64 bit
CPU
AMD Phenom II x6 1100T, 3.3 GHz
Motherboard
ASUS M4A88T-M/USB3 (AM3)
Memory
12GB DDR3 1333 G-Skill (4GB x 2), G-Skill (2GB x 2)
Graphics Card(s)
NVIDIA GeForce GTX 660
Sound Card
Realtek?
Monitor(s) Displays
Samsung S23B350
Screen Resolution
1920x1080
Hard Drives
WD Green 2TB (SATA), WD Green 3TB (SATA), WD Blue 4TB (SATA), WD Blue 6TB (SATA)
PSU
Cooler Master
Case
Antec GX300 Tower
Cooling
3x Antec TRICOOL 120mm Fans
Mouse
Wired Optical
Internet Speed
DSL
Antivirus
Avast
Browser
Pale Moon (64 bit)
Other Info
2018-12-27 Upgraded HDDs
2015-12-10 Upgraded case, graphics card, storage
2015-08-15 Upgraded motherboard & RAM
2015-07-15 Upgraded LM17.1 to LM17.2
Couldn't you put that code in a batch file and then create a "context menu" entry (in the "Registry") that points at the batch file?

I'm a bit snowed under at the moment, so I can't give you the specifics. :(
The "big brains" should be able to tell you how to do this off of the top of their heads.
XP used to have a built in tool for manipulating the "context menu".

Remember to backup up your OS, BEFORE you start messing with the Registry. :geek:

I couldn't even make it into a batch file successfully, so, no. :p Couldn't get the batch file to get the directory where it was running.
 

My Computer My Computer

At a glance

Windows 7 Home PremiumIntel i76 GBATi Mobility Radeon HD 5870
Computer Manufacturer/Model Number
ASUS G73
OS
Windows 7 Home Premium
CPU
Intel i7
Memory
6 GB
Graphics Card(s)
ATi Mobility Radeon HD 5870
Sound Card
Realtek HD
Screen Resolution
1600x900
Hard Drives
2x 500GB HDD
Mouse
Logitech MX1100
Internet Speed
ADSL2+
Back
Top