Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Reesche

macrumors member
Original poster
Mar 31, 2005
60
4
Spokane, WA
Hi you guys!

I have a question for you...

Say I have a folder of jpg files I want to convert and (rename and number) all the files in that folder..... how to easily convert them?

I have a ton of Aircraft images I want to simplify within a folder......

Example: Here is an example of the original file: 1280px-Iljushin_DB-3F_(SA-kuva_148731).jpg

I want all the files in a specific folder to go from.... Aircraft1.jpg to Aircraft200.jpg.

Is there an easy way to do this?

Thank you!
Reesche
 
  • Like
Reactions: zapmymac
Perfect job for shell scripting. No need to download anything.

Bash:
#!/bin/bash

# Check if the correct number of arguments is provided
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <directory_path> <base_name>"
    echo "Example: $0 /path/to/folder Aircraft"
    exit 1
fi

# Assign command-line arguments to variables
directory="$1"
base_name="$2"

# Check if the directory exists
if [ ! -d "$directory" ]; then
    echo "Error: Directory '$directory' does not exist."
    exit 1
fi

# Initialize a counter
counter=1

# Iterate over all files in the directory
for file in "$directory"/*; do
    if [ -f "$file" ]; then
        # Get the file extension
        extension="${file##*.}"
        
        # Construct the new file name
        new_name="$directory/$base_name$counter.$extension"
        
        # Rename the file
        mv "$file" "$new_name"
        
        # Increment the counter
        ((counter++))
    fi
done

echo "Files in '$directory' have been renamed to '$base_name' followed by a number."

  1. Open Terminal.
  2. Save the script to a file, for example, rename_files.sh: nano rename_files.sh
  3. Paste the above script into the file, then save and exit (Ctrl+O, Enter, Ctrl+X).
  4. Make the script executable: chmod +x rename_files.sh
  5. Run the script: ./rename_files.sh /path/to/folder Aircraft
    • Replace /path/to/folder with the path to the directory containing the files, and Aircraft with your desired base name.
 
Ok.... I am running the following system because I can not go to a higher System with my MacPro. See attachment....

I really do not want to use Terminal......

Renamer- requires to high of a OS.

Any other ideas?
 

Attachments

  • System Overview.png
    System Overview.png
    73.7 KB · Views: 20
I will load "GraphicConverter" to my MacPro now and check it out.....
 

Attachments

  • Screen Shot 2025-01-12 at 11.08.09 AM.png
    Screen Shot 2025-01-12 at 11.08.09 AM.png
    10.1 KB · Views: 23
Figured it out! This is the link I watched on YouTube...

My MAC's OS (10.14.6 Mojave) has the stuff to do this.

1. (Finder - File - Rename) Select the approporate files in the folder....Go to FILE - RENAME.... ADD TEXT and add a space for when you cut and copy to the next step......

2. Add and paste the Text.... with the space at the end....

3. FORMAT (name and index) add the numbers in sequence to the files.

It worked great! If I didn't do this way, it would have taken forever to get it right.

See 3 attachments below...

Thanks for you ideas, it got me on the right track.

Reesche
 

Attachments

  • 2 Add Text BEFORE with space.png
    2 Add Text BEFORE with space.png
    283.4 KB · Views: 35
  • 3 Format with space and number.png
    3 Format with space and number.png
    290.9 KB · Views: 33
  • 1 FINDER (Replace).png
    1 FINDER (Replace).png
    617.5 KB · Views: 31
Is there an easy way to do this?

You can also do this reliably in Automator on Mojave, and then save it as a finder plugin and add it to finder's contextual menu, so you select a bunch of files, right click, choose the action, and it'll spawn a dialogue box with the renaming options etc.
 
  • Like
Reactions: zapmymac
Apple - Rename files, folders and disks on Mac
"Rename multiple items
Format: Choose a name format for the files, then choose to put the index, counter or date before or after the name. Enter a name in the Custom Format field, then enter the number you want to start with."
 
I really do not want to use Terminal......
To bad, because it only takes 2 minutes and you'd be done by now.

But why even care about the filenames? What you need is tags or labels. What we call "meta data" for each file then you can search and sort the images any way you like or even have them in multiple "buckets" sorted simultaneously by multiple categories. If you are using filenames, you really need to re-think. It is very inflexible.
 
Mttspace and Blinky..... WHAT are these responses all about?? I took a lot of time to tell you and show you how I figured all of this out and this is your answers???? What is the problem here?

You found an answer that requires the entire task to be done every time. I suggested Automator, because it means once you configure it once via an effectively identical UI, you have it there to use again at zero time cost.

It's a better way to do the task, and these forums are often surfaced as a solution by search engines.
 
You're welcome, I guess.

++ It's like, why not just own an iPad, then? The Terminal is half of what a Mac is.

WOW.... the era that we live in now? How can I recommend this site to my friends?

The point of this message board, or any one like it, is to advance knowledge, including your own. Rejecting things that make you uncomfortable is disrespectful to the people who provide you with not just "a" solution but the best solution. But hey, your computer, your time. Glad you found a solution that works.
 
  • Like
Reactions: triptolemus
Ok.... I am running the following system because I can not go to a higher System with my MacPro. See attachment....

I really do not want to use Terminal......

Renamer- requires to high of a OS.

Any other ideas?
For Pete's sake, just use the Terminal. It's the same Terminal that computer users have used since 1970. Just navigate to the folder using cd and paste in the commands that somebody already wrote for you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.