So does this look right: ? If my source files are all in "L:\!Temp all" and the destination folders are all in L:\!TLF\a, etc. with every letter of alphabet in separate folder?
@echo off
setlocal enabledelayedexpansion
for %%D in (! 0-9 a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%F in ('dir /a-d /b L:\!Temp all\%%D*.*') do (
set src=L:\!Temp all\%%F
set dest=L:\!TLF\%%D\%%F
echo Source file: !src!
if not exist "!dest!" (
echo Moving !src! to !dest!
move "!src!" "!dest!"
) else (
echo !dest! already exists
)
)
)