Move all files containing string from multiple subfolders into the parent folder
You can also try where /r
, which returns the full file path in "%i"
for /f tokens^=* %i in ('where /r "C:\Source Folder" *colour*.png')do move "%~i" "C:\Staging Folder"
- Or...
cd /d "C:\Source Folder" & for /f tokens^=* %i in ('where /r . *colour*.png')do move "%~i" "C:\Staging Folder"
rem :: or using pushd and popd..
pushd "C:\Source Folder" & (for /f tokens^=* %i in ('where /r . *colour*.png')do move "%~i" "C:\Staging Folder") & popd
Some further reading:
[√] Pushd
[√] Popd
[√] For /F
[√] Where
[√] Where sample