Created
May 28, 2015 02:59
-
-
Save maten-rou/30854dfa45580d3b198f to your computer and use it in GitHub Desktop.
forfilesコマンドで特定フォルダ以下の指定したファイル名のファイルを抽出して、別のフォルダへコピーする ref: http://qiita.com/last-resort/items/8489d2442415fd68c689
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET FROM_DIR=抽出したいファイルが入っているフォルダ | |
SET TO_DIR=抽出したファイルを入れるフォルダ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET /p FILENAME="ファイル名を入力してさい(例:image_1) >" | |
echo off | |
@rem ディレクトリ設定 | |
SET IMG_DIR=img | |
SET CARD_DIR=tool | |
SET CUR_DIR=%cd% | |
SET FROM_DIR=抽出したいファイルが入っているフォルダ | |
SET TO_DIR=抽出したファイルを入れるフォルダ | |
@rem 作業ディレクトリ削除 | |
rmdir /S/Q %TO_DIR% | |
@rem コピーディレクトリ作成 | |
mkdir "%TO_DIR%" | |
@rem ネットワーク上のディスクをネットワークドライブに | |
pushd %FROM_DIR% | |
SET NET_DIR=%cd% | |
echo on | |
@rem card以下 コピー | |
forfiles /p %NET_DIR% /m *%FILENAME%* /c "cmd /c copy /z @path %TO_DIR%" | |
popd | |
cd %CUR_DIR% | |
pause | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ファイル名を入力してさい(例:image_1) > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment