Try this:
choose folder with prompt "Select the original folder" default location (path to documents folder)
set folderPath to contents of result
set folderPath to POSIX path of folderPath
do shell script "for x in `ls -1 " & folderPath & " | sed -e 's/^\\(.\\).*/\\1/' | sort -u`; do destination=$(echo $x | tr '[:lower:]' '[:upper:]'); mkdir " & folderPath & "$destination; mv -i " & folderPath & "${x}?* " & folderPath & "$destination/; done"
It's ignoring Capitalization, i.e.: Every file starting with a and A are moved to folder A/
EDITED 1:
Attempt to create the destination folder, but if it already exists, fail silently and move the files to it.
EDITED 2:
Open Dropbox folder by default:
set dropboxFolder to (POSIX path of (path to home folder) & "Dropbox")
choose folder with prompt "Select the original folder" default location (POSIX file dropboxFolder as alias)
EDITRED 3:
The final script:
set dropboxFolder to (POSIX path of (path to home folder) & "Dropbox")
choose folder with prompt "Select the original folder" default location (POSIX file dropboxFolder as alias)
set folderPath to contents of result
set folderPath to POSIX path of folderPath
do shell script "for x in `ls -1 " & folderPath & " | sed -e 's/^\\(.\\).*/\\1/' | sort -u`; do destination=$(echo $x | tr '[:lower:]' '[:upper:]'); mkdir " & folderPath & "$destination; mv -i " & folderPath & "${x}?* " & folderPath & "$destination/; done"