0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

一部一致する文字を指定して、指定フォルダへコピペするbatファイル

Last updated at Posted at 2022-12-20

ファイル名が一部一致する物を指定フォルダからコピペして移動するbatファイル

@echo off
set /p string="収集するファイル名に含まれる文字を入力してください:"
set /p folder="収集対象となるフォルダのパスを入力してください:"
set /p movefolder="コピー先のファイルパスを入力してください:"
 
rem 指定文字のフォルダを作成
if not exist %string% mkdir %string%
 
rem 収集対象フォルダへ移動
cd %folder%
 
rem 指定文字を含むファイルを探し収集する
for /r %%i in (*%string%*.*) do  (
  copy /y %%i %movefolder%
)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?