Code: Select all
for %%a IN (U:\*) do (
IF %%a = "ml_*" (
xcopy %%a X:\ABC\ /y
) ELSE (
xcopy %%a X:\PQR\ /y
)
)
Thanks !
Moderator: DosItHelp
Code: Select all
for %%a IN (U:\*) do (
IF %%a = "ml_*" (
xcopy %%a X:\ABC\ /y
) ELSE (
xcopy %%a X:\PQR\ /y
)
)
Code: Select all
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%F IN ('Dir X:\ABC\*') DO (
Set "f=%%~nF"
Set "pre=!f:~0,3!"
If /I [!pre!] equ [ml_] (
Echo --Copying File Name: !f! to folder A
Copy /v %%F \NewFolderA
) Else (
Echo -- Copying File Name: !f! to folder B
Copy /v %%F \NewFolderB
)
)
:Exit
Code: Select all
xcopy ml_* x:\abc
Code: Select all
echo \ml_>tmp.txt
echo \tmp.txt>>tmp.txt
xcopy .\*.* X:\PQR /exclude:tmp.txt
del tmp.txt
Code: Select all
for /f "usebackq tokens=" %%a in (`dir /a-d /b^|findstr /v /B "ml_"`) do xcopy %%a X:\PQR