I'm trying to figure out a way to execute commands on multiple files that exist in multiple folders. From what I understand, a for
loop is the best way to do this in CMD (I'm using Windows.) I'm running into some issues though, and I'll use one of the operations I need to do as an example.
For this specific command, I'm trying to make folders for multiple files, within multiple folders. Here's a visual:
Folder A
File 1.avi
File 2.avi
Folder B
File 3.avi
File 4.avi
I did some searching around, and I came up with this command:
for /f "delims=*" %a in ('dir *.avi /b /s') do md "%~na"
Which I scrapped together from here. This is almost right -- it makes a folder for each file contained within the multiple folders. The problem is, I need those new folders to be contained within the same folders as the files. This specific command would put the new folders in the place as the original folders, rather than within them.
Does anyone have any ideas? Any help would be appreciated. Thank you.