How to sequentially number files in a folder

Moderator: Forum moderators

Post Reply
User avatar
Flash
Moderator
Posts: 897
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 46 times
Been thanked: 105 times

How to sequentially number files in a folder

Post by Flash »

Note: this thread was split from another thread where it was off-topic. The first few posts might be confusing. Press on regardless. :)

Thanks for that, MochiMoppel. I use Rox's bulk rename to renumber the files in audiobooks. I'll have to see if the drag and drop feature works with it.

Chaos coordinator :?
User avatar
MochiMoppel
Posts: 1116
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 359 times

Re: How to sequentially number files in a folder?

Post by MochiMoppel »

Flash wrote: Thu Aug 04, 2022 2:47 am

I use Rox's bulk rename to renumber the files in audiobooks. I'll have to see if the drag and drop feature works with it.

And? Does it work? I guess not.
But I'm curious to know how you can renumber files with Rox's bulk rename. Example please.

User avatar
Flash
Moderator
Posts: 897
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 46 times
Been thanked: 105 times

Re: How to sequentially number files in a folder?

Post by Flash »

MochiMoppel wrote: Wed Aug 10, 2022 8:16 am
Flash wrote: Thu Aug 04, 2022 2:47 am

I use Rox's bulk rename to renumber the files in audiobooks. I'll have to see if the drag and drop feature works with it.

And? Does it work? I guess not.
But I'm curious to know how you can renumber files with Rox's bulk rename. Example please.

I haven't had an opportunity to use the drag and drop feature yet.
As for bulk renumbering files,

Rox bulk renumber.jpg
Rox bulk renumber.jpg (47.99 KiB) Viewed 889 times

To start with, the files are already numbered 001.jpg, 002.jpg, etc. I use Rox's bulk rename first to remove the leading zero (if not needed,) then again to add "of 67" to each file name.

Many years ago someone in the forum (moose? Something like that I think) made this script to use for renumbering audio books after ripping them with pcdripper:

Code: Select all

#!/bin/bash

sourcefolder=`pwd`

c=1
ls "$sourcefolder" | while read a;do

  b=`echo "00$c" | sed "s/.*\(...\)$/\1/"`
  echo "$b.mp3"

  mv "$sourcefolder/$a" "$sourcefolder/$b.mp3"

  c=$(($c+1))
done

Be careful, if you save it as a file in Rox and then click on it, it will rename all the files and folders in the directory where you put it. Ask me how I know. :oops: Best to put it in its own directory, to limit the damage it can do.

Chaos coordinator :?
User avatar
MochiMoppel
Posts: 1116
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 359 times

How to sequentially number files in a folder?

Post by MochiMoppel »

Flash wrote: Wed Aug 10, 2022 5:38 pm

Best to put it in its own directory, to limit the damage it can do.

:shock: Best to put it into your trash can! It's toxic and can ruin your system. Was proposed to you by forum member MU in your thread How to batch renumber files in a folder?, Originally was OK, then seaside proposed a dangerous change. Now if you run the script from a console and forget to open the console in the working directory it will rename all your files and directories in /root :o Certainly the last thing anyone would want.

Your original question back then was
"Is there a Regular Expression I can put in ROX's Bulk rename window that will rename the files in this folder, starting with 001 for the first file (now 0101) and ending at 231 for the last file (now 1220)?"
and the answer was no. You can not renumber filenames with ROX's Bulk rename window (hence the funny numbering script). Your post-processing with ROX is in my understanding formatting or string manipulation but not numbering.

If I understand correctly you still use the script, then ROX to do the rest. IMHO it would be much easier (and safer) to do all this at once, using a dedicated renaming tool like gFnRename or @JakeSFR 's MultiRename.

Screenshot.png
Screenshot.png (53.77 KiB) Viewed 999 times
multirename.png
multirename.png (121.55 KiB) Viewed 999 times
geo_c
Posts: 2501
Joined: Fri Jul 31, 2020 3:37 am
Has thanked: 1799 times
Been thanked: 705 times

Re: How to sequentially number files in a folder?

Post by geo_c »

MochiMoppel wrote: Thu Aug 11, 2022 5:35 am

IMHO it would be much easier (and safer) to do all this at once, using a dedicated renaming tool like gFnRename or @JakeSFR 's MultiRename.

I was using MultiRename last night to number .wav files so a script could create a soundfont. MultiRename is a great tool!

geo_c
Old School Hipster, and Such

User avatar
Flash
Moderator
Posts: 897
Joined: Tue Dec 03, 2019 3:13 pm
Location: Arizona, U.S.
Has thanked: 46 times
Been thanked: 105 times

Re: ROX: How to make the "Rename" box wider

Post by Flash »

@MochiMoppel, pardon my slow response.

You are correct, I misspoke in saying I used Rox to renumber.

Thanks for the examples of how to use the renaming utilities. I had looked at one of them years ago but couldn't see how to use it to do what I wanted. Since what I was using worked well enough, I didn't bother with them any further. Now with some examples to start with, I'll give gFnRename a try next time I need to renumber the files of an audio book.

Incidentally, gFnRename comes with EasyOS, in the Filesystem section of the Menu. Since it calls itself a utility, I initially looked for it in the Utility section of the Menu. It took me a while to find it.

Chaos coordinator :?
Post Reply

Return to “File Management”