0
Thanks

A few words of thanks would be greatly appreciated.

Batch file to move multiple files to multiple dir



Issue


I would like a batch file to move multiple files from multiple directories to one directory on one
drive. Example:


C:CanProdAMDDetailProc*.* 
C:CanProdAMDSumProc*.* 
C:CanProdPMDDetailProc*.* 
C:CanProdPMDSumProc*.* 
C:CanProdSMDDetaiilProc*.* 
C:CanProdSMDSumProc*.* 
C:CanProdKMDDetailProc*.* 
C:CanProdKMDSumProc*.*

Solution


You can try with the below script,

@echo off 

for /f "Tokens=* delims= " %%g in ('dir /b /s "C:CanProd" ^| find "Proc\"') do move"%%g" "destination path"


Note:

The destination path should finish like " D:test\". Path should end with the slash ().

Note


Thanks to Hawk for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

This document, titled « Batch file to move multiple files to multiple dir », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments