Ok I figured it out. It was because I used the wrong file names so I removed the 9 from the script. Thanks for the script.
Here are the changes I made:
@echo off
REM This script creates folders based on file names and moves those files into the folders.
REM *.jpg is the search term. Change this to search for different files.
REM md %name:~0,6% will make a directory based on the first 6 characters of the file name. Change to 5% for the first 5 characters.
REM move %* %name:~0,6% will move the file to the directory based on the first 6 characters of the file name. Change to 5% for the first 5 characters.
for /f %%F in ('dir/b/a-d *.jpg') do call :sub1 %%F
goto :eof
:sub1
set name=%1
md %name:~0,6%
move %* %name:~0,6%