Skip to content

Instantly share code, notes, and snippets.

@ramyamakkini
Last active December 23, 2015 01:29
REM Program to copy even named files in "all" to "even" directory and od named files to "odd" directory.
REM Author Ramya Makkini
echo OFF
setlocal enabledelayedexpansion
for /f "tokens=1,2,3* delims=(,)" %%f in ('dir /b C:\sample\all') do (
echo %%g
echo %%f%%g%%h
set /a num= %%g %% 2
if !num! == 0 (
copy C:\sample\all\%%f^(%%g^)%%h C:\sample\even\%%f^(%%g^)%%h
)
if !num! == 1 (
copy C:\sample\all\%%f^(%%g^)%%h C:\sample\odd\%%f^(%%g^)%%h
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment