Moving Images to different folders based on 1st number in name

property AceBankFolder : missing value
property RRDftpFolder : missing value

– Locate the AceBank folder
if AceBankFolder = missing value then set AceBankFolder to choose folder with prompt “Select AceBank folder:”

– Locate the RRDftp folder–
if RRDftpFolder = missing value then set RRDftpFolder to choose folder with prompt “Select RRDftp folder:”

display dialog "This script will move and organize the original images of the RRDftp folder to the AceBank. After moving and organizing the files in the RRDftp folder they will be deleted from the folder. Once Move Button is hit, there is no redo. " buttons {“Cancel”, “Move”} default button 1 with icon note

– saving the result is not needed. If the user presses Cancel, the script will be aborted

– (set theAnswer to the button returned of the result)

– moving files to Ace Bank-------------------------------------------

tell application “Finder” to set theFiles to (get files of RRDftpFolder)
set theCount to count theFiles
set x to 0 – error counter
set POSIX_AceBankFolder to POSIX path of AceBankFolder
repeat with eachFile in theFiles
tell application “Finder” to set fName to name of eachFile
– the shell command moves the files to the destination location and delete them at the source location
do shell script "mv " & quoted form of POSIX path of (eachFile as alias) & space & quoted form of (POSIX_AceBankFolder & character 1 of fName & “/” & fName)
on error
set x to x + 1
end try
end repeat

set theMsg to “Script completed.” & return
if theCount = 0 then
set theMsg to theMsg & “No items were moved.”
else if theCount = 1 then
set theMsg to theMsg & “1 item was moved.”
else if theCount > 1 then
set theMsg to theMsg & theCount & " items were moved."
end if

display dialog theMsg & return & x & " error(s)" buttons {“OK”} default button “OK”