Long story short I have one folder on a network share, that has 200+ other folders in them, some of which have .rar files in them. I want to extract all the .rar files IN PLACE. Not to another dir. For example I have 200+ folders inside the share z:\Foo. dir names 1-200 for simplicity sake. And I have .rar files in folders 2,5 and 20. (realistically its like 100+ .rar files) I want to run a command from "z:\Foo" that will look through all folders inside foo and extract the .rar files in the folder it finds them in, so 2, 5 and 20.
I have tried navigating to "z:\Foo" and running the command
FOR /F "usebackq" %a in (`DIR /s /b *.rar`) do 7z.exe e %a"
which works great but extracts all files to "z:\Foo" I was looking into using cmd prompt to run a command to search for .rar files and execute that command from within that dir but have had no luck. Something along the lines of
find . -type f -name *.rar -execdir FOR /F "usebackq" %a in (`DIR /s /b *.rar`) do 7z.exe e %a *.rar ';'
But that was a quick copy-pasta from another forum and I havent had the time or brainpower to diagnose it Nor have I had any luck modifying the code to try and get it to extract to the dir it finds the .rar file in. I have tried several other programs as well but none of them seem to work properly. I'm open to other options but would really just like to get this code working for simplicity sake. Ideally I want to just have to run this code every once and a while. Side note, I don't care if it overwrites files already unzipped but would prefer it skip files already unzipped, and I don't want it to delete the .rar file afterwards. Thanks for your time! Another thing, Im doing it this way because its usually 90% .rar files but sometimes .7zip files. Would like to keep it 7zip as the program so I can change the code to work on different zip types.