Answer the question
In order to leave comments, you need to log in
How to copy folders from a directory using a mask?
I have a directory with subfolders in which there are folders called LOG and BACKUP in large numbers. How can I run a script from the directory that will find all LOG and BACKUP in subfolders and save them to a separate directory without merging (Like LOG1 , LOG2 ... and etc)
Answer the question
In order to leave comments, you need to log in
Search for folders by mask using dir: dir /b /ad c:\temp\log*
Put this dir in for /f
:
for /f "tokens=* delims=" %%a in ('dir ...') do (
echo %%a
)
set /a "logidx=logidx+1"
for /?
dir /?
set /?
if /?
copy /?
move /?
md /?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question