@echo off
setlocal enabledelayedexpansion
rem 対象の親フォルダーを指定してください
set parentFolder="C:\data2\Openpose\openposeA"
rem 出力先のフォルダーを指定してください
set outputFolder=y:\\output
rem 出力フォルダーが存在しない場合は作成
if not exist "%outputFolder%" mkdir "%outputFolder%"
rem 親フォルダー内のすべてのファイルを再帰的に検索
for /r "%parentFolder%" %%F in (*_.png) do (
rem フォルダーとファイル名を分離
set fullPath=%%F
set fileName=%%~nxF
set filePath=%%~pF
set fileDrv=%%~dF
rem フォルダーパス内の「\」を「_」に置き換え
set modFilePath=!fileDrv:~0,1!!filePath:\=_!
rem 新しいファイルのフルパスを生成
set newFullPath=%outputFolder%\!modFilePath!!fileName!
@echo "!newFullPath!"
rem ファイルをコピー
copy "%%F" "!newFullPath!"
)
echo 処理が完了しました。
ディスカッション
コメント一覧
まだ、コメントがありません