开发者

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

开发者 https://www.devze.com 2023-03-21 11:30 出处:网络
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 fil

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.. th开发者_开发问答anks

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


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,

0

精彩评论

暂无评论...
验证码 换一张
取 消