massaki
massaki

Reputation: 799

Batch file to find specifc filenames inside folders and copy them to other place

I have a directory c:/go , inside go there is tons of folders, subfolders and files.

I need to find inside go, files that start with net*.inf and oem*.inf , and copy the folder, subfolders and all files where they are to another palce at c:/

please help.. thanks

It can also be vbs or any other way to run on the fly using windows...

Upvotes: 0

Views: 4408

Answers (1)

PA.
PA.

Reputation: 29339

BAT files are appropiate for iterating over the contents of a directory with the FOR command. See HELP FOR and HELP SET and try this

for /r %%a in (net*.inf) do (
  echo XCOPY %%~pa*.* \destination
)

Repeat the same for oem*.infor any other specifications you need.

After testing, remove the ECHO and adjust the XCOPY parameters to your appropiate requirements.

EDIT: per OPs comments, changed %%~fa to %%~pa to copy the complete folder content,

Upvotes: 2

Related Questions