If one were reckless, the solution could be a UNIX one-liner to iterate through all files and remove the first n characters. Instead, here is a Zsh script that can be run from the Terminal and it takes two arguments:
stripn.zsh 9 ~/Desktop/Test
As it loops through the available files, it tests each one to see if it has more than n characters in the base filename. If so, they are removed and the file is renamed. If not, the file is skipped. More code, more safe guards.
Copy/paste into a plain text editor (not Script Editor) and save. You can run a Zsh script even if your default SHELL remains Bash.
#!/bin/zsh
: <<"COMMENT"
Strip TRIMCHAR count of characters from beginning of filename and rename.
Usage: stripn.zsh nchars foldername
stripn.zsh 9 ~/Desktop/Test
Reference: https://discussions.apple.com/thread/255314870?sortBy=oldest_first
Tested: macOS Monterey 12.7.2, Zsh v5.8.1
Author: VikingOSX, 2024-01-15, Apple Support Communities, No warranties/indemnity.
Zsh Modifiers (.N): All non-dot files and return null string on failure
a: absolute path
s: substitute
r: drop path and extension
t: drop path just filename.ext
COMMENT
# number of characters to strip from base filename
TRIMCHAR=${1}
# if not numeric then error
(( ${TRIMCHAR} )) || {echo "First argument is the number of chars to strip.";exit 1}
# force tilde or just folder name to absolute path
STARTDIR="${2:a:s/\~\//}"
# extensions of files to affect. Modify to suit, or use * alone for all
EXT="(txt|jpg|jpeg|tif)"
cd "${STARTDIR}"
# case-insensitive file handling
setopt nocaseglob
for f in *.${~EXT}(.N);
do
# determine char length of base filename w/o newline
LEN=$(echo -n "${f:r}" | wc -m)
[[ ${LEN} -gt ${TRIMCHAR} ]] || continue
# cut char 1 - TRIMCHAR from filename resuming with TRIMCHAR + 1 char
/bin/mv "${f:t}" $(/usr/bin/cut -c $((TRIMCHAR + 1))- <<<"${f:t}")
done
exit 0