I've done a lot of searching but haven't been too successful. So I apologise in advance if this has already been covered and I missed it in my search.
I want to create two batch files. One that deletes a specific file type, as well as the subdirectory that it's contained in and everything else contained in that subdir. And another that copies a specific file type, as well as the subdirectory it's contained in and everything else contained in that subdir.
For example....say these folders exist
So, the Joe & Alan folders contain for example .jpg files, as well as other file types like .txt files and other subdirectories containing other arbitrary files. The mary & jane folders don't contain any .jpg files.
I would want the batch file to scan through D:/test-folder/stuff/A/ and delete all the .jpg files, as well as the subdir they are contained in and everything else contained in that subdir. So after running it I would want to be left with
For the copying batchfile, I would want to do the opposite. When I run it, it would check through D:/test-folder/stuff/A/ and copy any .jpg files and the subdir they are contained in, as well as the other file types/subdirs in that directory to a new folder.... in this example D:/test-folder/newstuff/A/
So after running it, I would have
those folders would contain the .jpgs, as well as the other filetypes and subdirs that were also contained.
I apologise for my long-winded and possibly confusing way of explaining this request
so far I have only managed to create batch files that either delete a certain file type, but leaves the folders/subfolders intact. Or copies a certain file type, and recreates the folder name, but doesn't copy the other filetypes/subdirs contained in the original folder.
Any ideas ?