renumber *already existing* file numbers

Is there a way to renumber *already existing* file numbers? Example:


The prefix of the file sequence is: "13 -", "14 -", etc. I'd like to replace these with "1. ", "2. ", etc.


Most renaming functions I've seen don't take into account a changing prefix (numeric, ascending); or they don't allow you to strip the first 4 characters out (using wildcards, for ex.) and start numbering from there while keeping the same file order. (At least, not in Automator or in the finder's rename function).


There must be a way; I just haven't found it.


Tips appreciated. Thanks.




MacBook Pro 13″, macOS 10.15

Posted on Jul 6, 2020 9:28 AM

Reply

Similar questions

10 replies

Jul 6, 2020 10:27 AM in response to VikingOSX

The files are like this:


13 - I. Allegro molto e *** brio.mp4

14 - II. Largo, *** gran espressione.mp4

...

20 - I. Allegro.mp4

21 - II. Allegretto.mp4



etc.


I tried Transnomino, which permits wildcards, but after I remove the first 5 characters, the finder reorders them, placing 20 after 13, which just creates another set of problems.


I am just trying to renumber the entire sequence 1-26 (in this case), replacing the numbering they currently show but keeping the order of the existing sequence. Not worth the trouble, perhaps?

Jul 6, 2020 10:10 PM in response to Eau Rouge

Tried it. No wildcards capability in the older version I own (will check the latest). Someone on this site recommended Transnomino, which does have wildcards, but I described the problem with that above.


also have tried several other likely suspects. It's such a simple operation, yet really hard to do with these apps. Scripting may be the best solution.

Jul 7, 2020 4:09 AM in response to jinet

The following Zsh Terminal syntax would replace the "1 - ." with "1. ." in the renaming (mv) process. The :a is absolute path, and :s is the substitution. The (.N) restricts to regular files, and N is shorthand for nullglob, meaning don't run the for loop on an empty directory.


for f in ~/Desktop/Test_this/*.mp4(.N);
do
   mv ${f:a} ${f:a:s/ -/./}
done


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

renumber *already existing* file numbers

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