Automator in Sequoia renaming files sequentially wrong

Automator in Sequoia renaming files sequentially wrong, I want rename file 1, file 2, file 3 like file00, file01, file02, it doesn't work, it take file random, so the file3 became file00 etc.., but if use my old macmini with Lion It works very well, why?



MacBook Air (M3, 2024)

Posted on Dec 16, 2025 3:09 PM

Reply
5 replies

Dec 16, 2025 7:20 PM in response to gianki281

gianki281 wrote:

Automator in Sequoia renaming files sequentially wrong, I want rename file 1, file 2, file 3 like file00, file01, file02, it doesn't work, it take file random, so the file3 became file00 etc.., but if use my old macmini with Lion It works very well, why?

Did you first have Automator sort the selected items before renaming them? I just tested the workflow & it keep the numerical order for me. Tested with macOS 26.1 Tahoe.


Dec 17, 2025 6:37 AM in response to gianki281

Another way to sequentially rename files with user-specified suffix of zero padding size:


#!/bin/zsh

: <<"COMMENT"
Sort every non-zero sized file by name (.NonL+0) in the specified directory
and then rename with sequential ZEROPAD numeric suffix.

Usage: ./rename.zsh path/to/folder
       ./rename.zsh ~/Desktop/PDF

Also usable in Run Shell Scripts where the folder name is passed to it as an
argument.

Tested: macOS Tahoe 26.2
VikingOSX, 2025-12-17, No warranties expressed or implied.
COMMENT

autoload -U zmv

# initialize counter variable
typeset -i cnt=1

# no arguments, then die
(( $# )) || {echo "Please supply starting directory on command line."; exit 1}

STARTDIR="${1:a:s/\~\//}"
ZEROPAD=3

cd ${STARTDIR}
# echo execution but do not actually rename any files
# zmv -Qn '(*).(*)(.NonL+0)' '$1_${(l:${ZEROPAD}::0:)$((cnt++))}.$2'
zmv -Qv '(*).(*)(.NonL+0)' '$1_${(l:${ZEROPAD}::0:)$((cnt++))}.$2' &> /dev/null
exit 0

Automator in Sequoia renaming files sequentially wrong

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.