Link to home
Start Free TrialLog in
Avatar of GurcanK
GurcanK

asked on

Windows Batch to Copy Files in an Excluded Set

Dear Experts,

I would like to write a batch script (CMD) to copy files from c:\temp of one Windows machine to a shared folder let's say pshared in another machine. However, the script should copy files with names not starting with B,DE and F. How can I achieve this?

Best Regards
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GurcanK
GurcanK

ASKER

Anything other than robocopy such as copy or xcopy?
Not without additional scripting; and robocopy is far better anyway. In Vista, the xcopy help even provided a warning that it's deprecated and robocopy should be used instead.
not sure that pure batch can handle this other than copy all, then delete B*,D*,E*,F*.  
this works but is not very efficient
set typ=*.frm
set src=c:\ee
set dest=c:\ee\done
xcopy /C %Src%\%typ% %dest%
del /q %dest%\B*.*
del /q %dest%\E*.*
del /q %dest%\F*.*
del /q %dest%\G*.*

Open in new window


 
is vbscript ok ??
set typ=*.*
set src=c:\temp
set dest=\\zeus\phared
xcopy /C %Src%\%typ% %dest%
del /q %dest%\B*.*
del /q %dest%\E*.*
del /q %dest%\F*.*
del /q %dest%\G*.*

Open in new window