1.

Solve : bat file to move folder(s) containing certain file type?

Answer»

I need the bat file to scan a directory (Folder A) and look at all of the SUBFOLDERS. If a subfolder contains any .PDF files (subfolder A1) then I need that folder to be moved into a NEW location (Folder B). Is this even possible via bat? The tree looks like this:

Folder A
   A1
     1.txt
     2.txt
     3.pdf
   B1
     1.txt
     2.jpg

So only the A1 subfolder would be moved to Folder B because it contained a .pdf fileTest this on some COPIES of your folders.

Code: [Select]ECHO off
for /r "d:\folder A" %%a in (*.pdf) do if exist "%%a" move "%%~dpa" "d:\folder B"



Discussion

No Comment Found